Loop - foreach series

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

Jelena
Posts: 11
Joined: Wed Dec 04, 2013 7:28 am

Loop - foreach series

Postby Jelena » Wed Dec 04, 2013 7:33 am

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

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Loop - foreach series

Postby EViews Gareth » Wed Dec 04, 2013 8:51 am

Code: Select all

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

Jelena
Posts: 11
Joined: Wed Dec 04, 2013 7:28 am

Re: Loop - foreach series

Postby Jelena » Wed Dec 04, 2013 10:10 am

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

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Loop - foreach series

Postby EViews Gareth » Wed Dec 04, 2013 10:11 am

You have to make an EViews program (File->New Program)

Jelena
Posts: 11
Joined: Wed Dec 04, 2013 7:28 am

Re: Loop - foreach series

Postby Jelena » Wed Dec 04, 2013 10:37 am

Thank you! Now it works :)


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests