Page 1 of 1

Loop - foreach series

Posted: Wed Dec 04, 2013 7:33 am
by Jelena
Hello,

I want to standardize all variables in the following way:

series std_inflation= (inflation-@mean(inflation))/@stdev(inflation)

Is there any command, which can be used to do this foreach (and all) series I have in my workfile at once?

Thanks in advance!
Jelena

Re: Loop - foreach series

Posted: Wed Dec 04, 2013 8:51 am
by EViews Gareth

Code: Select all

%list = @wlookup("*", "series") for %j {%list} series std_{%j}= ({%j}-@mean({%j}))/@stdev({%j}) next

Re: Loop - foreach series

Posted: Wed Dec 04, 2013 10:10 am
by Jelena
Hello,

thanks for your response!
I just started using Eviews...

When I use:
%list = @wlookup("*", "series")
there is no error but I can not see any changes in the workfile.

After the next command:
for %j {%list}
Eviews shows following Error Message:
Flow of control statement executed from the command line

Then the next command:
series std_{%j}= ({%j}-@mean({%j}))/@stdev({%j})
gives the Error: %J is not a valitd string or scalar name.

What did you do wrong?

Thanks in advance!
Jelena

Re: Loop - foreach series

Posted: Wed Dec 04, 2013 10:11 am
by EViews Gareth
You have to make an EViews program (File->New Program)

Re: Loop - foreach series

Posted: Wed Dec 04, 2013 10:37 am
by Jelena
Thank you! Now it works :)