Recursive Problem in Integer-based loops
Posted: Mon Aug 26, 2013 8:12 am
Sorry for the confusing title to this thread. I have the following snippet of code:
for !i=2 to 12
genr gain_g{!i}_{%s}=g{!i}_{ %s}-g{!i-1}_{ %s}(-1)
next
where each gain_g!... series is previously created with NA values using "series". I want the loop to give them values as such:
gain_g2...=gain_g2-gain_g1...(-1).
However, specifying it as g{!i-1} gives me an error.
Any ideas?
Thanks,
BL
for !i=2 to 12
genr gain_g{!i}_{%s}=g{!i}_{ %s}-g{!i-1}_{ %s}(-1)
next
where each gain_g!... series is previously created with NA values using "series". I want the loop to give them values as such:
gain_g2...=gain_g2-gain_g1...(-1).
However, specifying it as g{!i-1} gives me an error.
Any ideas?
Thanks,
BL