To be honest, I didn't read through all your code, or try it out on a
sample dataset, but I suspect that the section labeled "Creates 5-year
period indicator" is introducing the error. Try this instead (and
also investigate whether you have missing years or duplicate years
within ifscode values):
iis ifscode;
tsset ifscode year;
*** Creates 5-year period indicator;
gen indpd =year-mod(year,5);
**** Creates 5-year averages ;
collapse (min) year ifscode (mean) tot_exp cap_exp
curr_exp odanet2 real_gdp_pc mor_inf agr_gdp lag_agr
litadu_pop system allhouse yrcurnt exelec exconst
legelec pr military state yrsoffc oda_yr oda_sys
oda_house oda_ex oda_leg oda_pr oda_mil oda_const
oda_st oda_offc , by(name indpd);
On 4/26/06, ilker kaya <[email protected]> wrote:
> Dear Austin,
>
> Here is the code that I am using for sorting and
> taking 5 year avarages. I hope this part would be
> enough to tell if there is anyting wrong.
> ifscode is unique for each country in my data file and
> year is between 1960-2002.
> Thank you very much.
> Regards,
>
> ilker
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/