Loop over pre-defined string

For questions regarding programming in the EViews programming language.

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

PaulvanErp
Posts: 3
Joined: Thu Sep 19, 2013 2:01 am

Loop over pre-defined string

Postby PaulvanErp » Wed Oct 16, 2013 4:35 am

Hi,

I have a pre-defined string containing variables:

%components = "pieh schp banp ncar main"

I want to loop over these variables, like I do here:

for %n {%components}
series dc_{%n}
call devcycle (dc_{%n}, {%n}, 0)
delete {%n}
next

This combination of variables is used multiple times in my program and I do not want to change it everywhere, but only once (at the start of my program), so it is also easy to use for others. Unfortunately this does not work, since it does not take the five components as seperate variables, but defines %n = "pieh schp banp ncar main".

Can/should this be done in a different way?

Thanks,

Paul

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

Re: Loop over pre-defined string

Postby EViews Gareth » Wed Oct 16, 2013 6:50 am

Which version of EViews?

PaulvanErp
Posts: 3
Joined: Thu Sep 19, 2013 2:01 am

Re: Loop over pre-defined string

Postby PaulvanErp » Thu Oct 17, 2013 12:40 am

EViews 6

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

Re: Loop over pre-defined string

Postby EViews Gareth » Thu Oct 17, 2013 6:25 am

Then you can not.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests