Dear all,
In the data below ( actual data has more observations), I want to fill in the value of Xindex for the missing years by cnum which is a firm unique id, that is, 5 should be assigned to year 1991 1992 for "000209" , I will not fill in data for the time period after the last year, that is if a firm e.g. "000209" has data 1990 to 1993, I will not fill in after 1993.
What I need : for each firm it could have different starting year and ending year. just want to fill in the gap between these two. for ""000361" , it should have no missing values between 1990 and 2006 after fill in.
Thanks a lot,
Rochelle
In the data below ( actual data has more observations), I want to fill in the value of Xindex for the missing years by cnum which is a firm unique id, that is, 5 should be assigned to year 1991 1992 for "000209" , I will not fill in data for the time period after the last year, that is if a firm e.g. "000209" has data 1990 to 1993, I will not fill in after 1993.
What I need : for each firm it could have different starting year and ending year. just want to fill in the gap between these two. for ""000361" , it should have no missing values between 1990 and 2006 after fill in.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int year byte xindex str6 cnum 1993 5 "000209" 1990 5 "000361" 1993 5 "000361" 1995 5 "000361" 1998 5 "000361" 2000 5 "000361" 2002 5 "000361" 2004 5 "000361" 2006 5 "000361" end
Rochelle
Comment