Last request on Statalist.
In my dataset, I have about 600 ID-codes. For many of these codes I have monthly data. Some ID-codes have monthly data for several years.
Could someone adjust the code so that it works for my whole dataset instead of only for the first year of the first ID-code.
I only need to keep the final annualized result for each year. For example, if an ID-code has monthly data from jan2013 until may2014. Then I only want to keep the annualized result of dec2013 and the annualized result of may2014.
Code:
gen chgdec = monthlydata+1 //Take log gen logchgdec = log(chgdec) //Sum them up gen sumchg = sum(logchgdec) //Exp gen expsumchg = exp(sumchg) //Annualize gen annual = expsumchg^(12/_n)-1
In my dataset, I have about 600 ID-codes. For many of these codes I have monthly data. Some ID-codes have monthly data for several years.
Could someone adjust the code so that it works for my whole dataset instead of only for the first year of the first ID-code.
I only need to keep the final annualized result for each year. For example, if an ID-code has monthly data from jan2013 until may2014. Then I only want to keep the annualized result of dec2013 and the annualized result of may2014.
Comment