Re: loop with string variables
Posted: Wed Nov 17, 2010 11:45 am
You're doing the looping correctly. However you are not using string variables correctly. A string variable is literally that; a variable containing a piece of text. If you want to use an EViews object with a name equal to the piece of text, you have to enclose the string variable in { }.
i.e. when you say
You're saying "take the piece of text stored in %i and divide it by 100."
When you say
You're saying "take the object called %i and divide its contents by 100."
Thus you should change your code to be:
i.e. when you say
Code: Select all
%i/100
When you say
Code: Select all
{%i}/100
Thus you should change your code to be:
Code: Select all
for %i x y z j k
series pc_{%i}={%}i/{%i}(-1)*100-100
next