Announcement

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

  • How can I remove firms in a panel dataset when they do not have 20 years of uninterrupted data?

    The question is as explained in the title, I have to remove the firms in a dataset if they do not have 20 years of uninterrupted data.
    I need data from each firm from 1992-2012, however multiple firms do not have these data, either they start later (1996-2012) or they are missing a few years in between (1992-1997, 1999-2012).
    These firms have to be removed.
    Is there a formula that I can apply in Stata?

  • #2
    1992-2012 sounds like 21 years of data to me. You don't quite say that you have yearly data but if you do then

    Code:
     
    bysort firmid : drop if _N < 21
    might be as much as you need. If your situation is more complicated, you can do something like this

    Code:
     
    bysort firmid : gen nobs = _N
    su nobs 
    drop if nobs < !!!
    where you must supply the value denoted !!!

    Comment

    Working...
    X