Announcement

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

  • how to create a variable for the previous year for the same firm

    Hello!

    I have some data that could use firm id and year to identify which firm it is, and which year the observation occurs. For each firm id, I want to create an observation for its previous year, e.g., with firm id 2345 in year 2009, I want another line also with firm id 2345, but the year shown is 2008. How can I do this?

    Thanks a lot for any help : )

  • #2
    Presuming there is only one observation per firm/year, this sounds like:
    Code:
    expand 2, gen(new)
    replace year = year-1 if new

    Comment


    • #3
      Thanks Mike, this works well.

      Comment

      Working...
      X