Announcement

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

  • Fill in values for panel data

    Hi,

    I have a panel dataset with observations for years 2008 and 2012. All firms have a unique firm ID. All the firms in year 2012 have a value for established_year. For the firms in 2008 this is missing. Using the unique firm id (firm_id) I want to copy the values from 2012 and fill them in for established_year in 2008. Any idea on how I can achieve this?

  • #2

    Code:
    bysort firm_id (year) : replace established_year = established_year[2] if missing(established_year[1])

    Comment

    Working...
    X