Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating year variable

    Dear all,

    I am going to create a year variable. There are 320 rows and one variable "lwage". I need to make 10 years, starting from 2010. I mean the first 32 obs receives 2010 the second one 2011 ....the last 32 obs receives 2019.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float lwage
    6.425638
    6.461812
    6.591312
    7.209437
    7.696047
    6.663199
    6.821919
    7.277867
     7.72025
    6.703345
     6.89688
    7.349153
    7.724151
    6.762828
    6.990525
    7.364118
    7.696399
     6.43328
    6.431738
    6.553126
      7.0012
    6.481446
    6.531979
     6.70796
    7.173141
    6.524034
    6.622344
    6.860659
     7.40061
    6.573124
    6.689656
    7.019666
    6.666642
    6.841504
    7.294862
     7.71414
    6.723149
    6.943739
    
    end
    Any ideas appreciated.

    Cheers,
    Paris

  • #2
    Code:
    egen year = seq(), from(2010) to(2019) block(32)

    Comment


    • #3
      Thats perfect. Thank you so much, Nick.

      Comment

      Working...
      X