loop for string variables

For questions regarding programming in the EViews programming language.

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

SP123
Posts: 2
Joined: Thu Mar 14, 2019 5:10 pm

loop for string variables

Postby SP123 » Thu Mar 14, 2019 10:04 pm

Hi there,

I want to repeat the same calculation for numerous string variables. For example act/act_rb, nsw/nsw_rb etc. Below is the code I have written.

%seriesname = @wlookup ("*", "series")
for %n {%seriesname}
next
For %N act nsw qld vic %Y act_rb nsw_rb qld_rb vic_rb
series stack = {%N}/{%Y}
next

When I run the program it comes up with a syntax error. Can you please help ?

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

Re: loop for string variables

Postby EViews Gareth » Fri Mar 15, 2019 7:46 am

Code: Select all

For %N %y act act_rb nsw  nsw_rb qld  qld_rb vic  vic_rb
series stack = {%N}/{%Y}
next
Follow us on Twitter @IHSEViews

SP123
Posts: 2
Joined: Thu Mar 14, 2019 5:10 pm

Re: loop for string variables

Postby SP123 » Sun Mar 17, 2019 7:53 pm

Thanks you for that. Is it possible for me to save each of the calculation in separate series or in one group ? thanks in advance again.
Last edited by SP123 on Sun Mar 17, 2019 8:22 pm, edited 1 time in total.

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

Re: loop for string variables

Postby EViews Gareth » Sun Mar 17, 2019 7:55 pm

Then give each series a different name.
Follow us on Twitter @IHSEViews


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 18 guests