Urgent Help needed

GVRY

New Member
#1
Hi,

I have an unbalanced panel for 350,000 firms for the years 1995 to 2008. I want to see for how many firms I have data only for the year 2008. So basically I want to summarize the firmids for each year separately showing firms for which data is available only for that particular year. But am unable to do so. A sum firmid if year==2008 is giving me all firms for which data is available for 2008 irrespective of whether it is available for other years. I want only the number of firms for which data is available for year 2008 but not for any of the other years. How do I check for that in STATA. I need to work on this dataset for my prof urgently. So any help on how to get the number of observations would be highly appreciated.
 
Last edited:
#2
Hey there,

So basically you want to count the number of firms that are in your sample just once and in 2008. First generate a variable that count the number of years a firm is in the sample :

by firmid : gen num == _N

and then count the number of firms you are interested in

count if num == 1 & year == 2008

Hope this helps!

Etienne