Page 1 of 1

Creating loops with different variables

Posted: Fri Jan 27, 2012 4:24 am
by mjamei
Hi,

I'm trying to create a program that works out a simple quarter on quarter change on a number of variables however I can't get the loop function to work fo some reason.

Here's the code:
for %v NEVI NEVJ NEVK NEVL
smpl 1990:01 2010:04
delete p%v
genr p%v = 100*(%v/%v(-1))-1)
next

I've only included a couple of variables here to demonstrate but it keeps coming back with an error message so I'm assuming I've made a mistake in the coding (or more than one mistake! :/)

Thanks in advance

Re: Creating loops with different variables

Posted: Fri Jan 27, 2012 6:04 am
by reep
You have to use {} around %v.
for example: p{%v}

Re: Creating loops with different variables

Posted: Thu Feb 02, 2012 10:11 am
by mjamei
Brilliant, works fine.

Thanks