On Thu, 2 Sep 2010, Henrique Andrade wrote:
How can I accumulate a series in 12 months inside a script? Now this
is what
I'm doing:
series var112m = var1 + var1(-1) + var1(-2) + var1(-3) + var1(-4) + var1(-5)
+ var1(-6) + var1(-7) + var1(-8) + var1(-9) + var1(-10) + var1(-11)
Could you please suggest a more elegant way?
# cumulate var1
series var1cum = cum(var1)
# take the annual difference
series var112m = var1cum - var1cum(-12)
# and fill in the dropped observation
var112m[12] = var1cum[12]
Allin Cottrell