Page 1 of 1

Looping Through Replacement Variables

Posted: Thu Oct 29, 2015 5:51 am
by alicia
I'm trying to create a program that contains many equation specifications, and then loops through them one at a time and performs various actions on them. I'm having trouble with the replacement variables.

When I run the code below I get an error: MYEQUATION1 is not defined in "LS MYEQUATION1"

Code: Select all

%myEquation1 = "depvar c indepvar1" %myEquation2 = "depvar c indepvar1 indepvar2" for !mycounter=1 to 2 %Equation="myEquation"+@str(!mycounter) ls {%Equation} next
I'm sure it's something simple, but I'm just not seeing it!

Thanks.

Re: Looping Through Replacement Variables

Posted: Thu Oct 29, 2015 6:40 am
by EViews Gareth
Try:

Code: Select all

for !mycounter=1 to 2 %Equation="%myEquation"+@str(!mycounter) ls {{%equation}} next

Re: Looping Through Replacement Variables

Posted: Thu Oct 29, 2015 4:37 pm
by alicia
Perfect!

Thanks