I have a program where the same loop is coming at various occasions:
for %y fr us uk
If I then need to change my loop, e.g. replace "for %y fr us uk" by "for %y fr us", I will have to do so every time the loop is coming in the program. Ideally, I would like to make only one change and see this change reflected in all the loops. I am thinking of replacing the content of the loop by a replacement variable to be defined at the start of the program but the way I do it does not work:
%loop = "%y " + "fr " + "us " + "uk"
for %loop
scalar s_{%y}=1
next
The following does not work neither:
%loop = "%y " + "fr " + "us " + "uk"
for {%loop}
scalar s_{%y}=1
next
I guess this is an important question while programing. Any idea?
Replacement variable to replace various strings in loop
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13586
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Replacement variable to replace various strings in loop
Code: Select all
%loop = "fr " + "us " + "uk"
for %y {%loop}
scalar s_{%y}=1
next
Re: Replacement variable to replace various strings in loop
Thanks
Your reply makes sense and must be correct but I guess it is only be valid on later versions of Eviews. I have tried it on Eviews 5 and it does not work.I am aware Eviews 7 has made progress with strings and I suppose your code must be working on the latest version.
Thanks again
Your reply makes sense and must be correct but I guess it is only be valid on later versions of Eviews. I have tried it on Eviews 5 and it does not work.I am aware Eviews 7 has made progress with strings and I suppose your code must be working on the latest version.
Thanks again
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Replacement variable to replace various strings in loop
The replacement of the loop strings is a version 7 feature.
Who is online
Users browsing this forum: No registered users and 2 guests
