Announcement

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

  • Create panel setting

    Hello,

    My dataset does not have any time variables but I would like to create years 1970-2010 (delta(1)) for each id.
    My current dataset looks like
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float id
    2171
    2172
    2902
    2903
    end
    and I would like to create

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float id float year
    2171 1970
    2171 1971 
    ...
    2171 2010
    2172 1970
    2172 1971 
    ...
    2172 2010
    2902
    2903
    end
    Normally, I can use -fillin- but since I don't have any 'year' variable now, I wonder how to create it.

    Thank you in advance!

  • #2
    how do you know what year matches each id?

    Comment


    • #3
      I want to merge with another dataset that has both 'id' and 'year' and would like to do 'merge 1:1' instead of '1:m'.
      Would that be possible too?

      Comment


      • #4
        I can't figure out what you have in your data that permits you to assign a year to an observation.

        Comment


        • #5
          I used this and created year variables
          Code:
          expand 31
          bysort id: gen year=1970+_n
          Thank you

          Comment


          • #6
            are you sure those years are correct?

            Comment

            Working...
            X