Dear Stata Users;
I'm having some troubles with the collapse command. Since I'm working with a dynamic panel model (GMM) I need to collapse all my data into 5-years averages (mean) and (sd). The thing is I have created a new variable :
gen period=.
replace period=80 if year>=1980 & year<1985
replace period=85 if year>=1985 & year<1990
replace period=90 if year>=1990 & year<1995
replace period=95 if year>=1995 & year<2000
replace period=100 if year>=2000 & year<2005
replace period=105 if year>=2005 & year<2010
Then when I collapse everything by (country period) the outcome is wrong. Since I have missing observations it should collapse by each observation right?
I guess I need to create another variable related to nr or id but I don't know how to to do it.
I really appreciate any advice.
Best Regards
Santiago
I'm having some troubles with the collapse command. Since I'm working with a dynamic panel model (GMM) I need to collapse all my data into 5-years averages (mean) and (sd). The thing is I have created a new variable :
gen period=.
replace period=80 if year>=1980 & year<1985
replace period=85 if year>=1985 & year<1990
replace period=90 if year>=1990 & year<1995
replace period=95 if year>=1995 & year<2000
replace period=100 if year>=2000 & year<2005
replace period=105 if year>=2005 & year<2010
Then when I collapse everything by (country period) the outcome is wrong. Since I have missing observations it should collapse by each observation right?
I guess I need to create another variable related to nr or id but I don't know how to to do it.
I really appreciate any advice.
Best Regards
Santiago
Comment