Announcement

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

  • Changing id into time format

    I have data in long format of the form

    * Example generated by -dataex-. For more info, type help dataex
    clear
    input str78 holder double(v202 v201 v203 v204 v205 v206 v207 v208)
    "Czech Republic" 13.206034 8.674691 5.799447 4.272415 5.388991 3.795726 3.304107 6.172469
    "France" 539.783804 274.727544 558.503197 324.876303 233.718778 327.439928 257.006939 312.012246
    "Belgium" 468.66532 329.483381 493.310086 329.301657 224.025277 162.776653 251.66511 290.292112
    end

    The v-Variables denote the value of the variable in different quarters, so, e.g. v202 is the value in 1970q1, v203 in 1970q2 etc.

    I do a reshape

    reshape long v, i(holder) j(time)

    input str78 holder int time double v
    "Belgium" 201 329.483381
    "Belgium" 202 468.66532
    "Belgium" 203 493.310086
    "Belgium" 204 329.301657
    "Belgium" 205 224.025277
    "Belgium" 206 162.776653
    "Belgium" 207 251.66511
    "Belgium" 208 290.292112
    "Czech Republic" 201 8.674691
    "Czech Republic" 202 13.206034
    "Czech Republic" 203 5.799447
    "Czech Republic" 204 4.272415
    "Czech Republic" 205 5.388991
    "Czech Republic" 206 3.795726
    "Czech Republic" 207 3.304107
    "Czech Republic" 208 6.172469
    "France" 201 274.727544
    "France" 202 539.783804
    "France" 203 558.503197
    "France" 204 324.876303
    "France" 205 233.718778
    "France" 206 327.439928
    "France" 207 257.006939
    "France" 208 312.012246
    end

    Now, I want to change the "time-id" into quarterly, so I do

    format time %tq

    Now, the variable time contains 2010q2 to 2012q1. However, I want it to start at 1970q1. How can I tell Stata to start at this particular quarter?



  • #2
    Ah, sorry, I found the answer myself. The timecount starts at 1960q1. So 201 means 50 years and one quarter ahead from 1960q1, i.e., 2010q2.

    Comment

    Working...
    X