Page 1 of 1

Looping an equitation with different variables

Posted: Wed May 29, 2019 10:25 am
by miorinnovo
I'd like to create a number of series from the same equation with a number of different independent variables. For example y=0.5*x, but where I change what x is a number of times. I'm not quite getting the loop right. I tried:l

Code: Select all

for %var {%var_list} %v1="firstvariable" %v2="secondvariable" series {%var}forecast = 0.5*{%var} next
But I get a syntax error...

Any ideas?

Thanks

Re: Looping an equitation with different variables

Posted: Wed May 29, 2019 10:31 am
by EViews Gareth
Nothing wrong with the code you posted (other than the %v1 and %v2 doing nothing).

Code: Select all

create u 100 series x=nrnd series y=nrnd series z=nrnd series w=nrnd %var_list = "x y z w" for %var {%var_list} %v1="firstvariable" %v2="secondvariable" series {%var}forecast = 0.5*{%var} next

Re: Looping an equitation with different variables

Posted: Wed May 29, 2019 10:43 am
by miorinnovo
Thanks!