Double looping

For questions regarding programming in the EViews programming language.

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

fox6327
Posts: 4
Joined: Thu Mar 11, 2021 11:01 am

Double looping

Postby fox6327 » Thu Mar 11, 2021 11:19 am

Hi All,

I am trying to do double looping across regions and countries.
Now I have two regions (Europe and FSU) and I am trying to perform the same operation across regions and countries. If a specify the region (i.e. %r="Europe") then the code works well, however, I receive an error once I add a loop for the two regions.

%rgn="europe fsu"
for {%r} {%rgn}

if %r="Europe" then %ctry="deu fra ita esp nld pol bel aut fin nor che swe eu"
endif

if %r="FSU" then %ctry="rus ukr aze"
endif

for %x {%ctry}
group {%x} demand_{%x}*
next
next

Any ideas what the issue can be? The code has already given me quite a lot of headaches...

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

Re: Double looping

Postby EViews Gareth » Thu Mar 11, 2021 11:30 am

Probably a case issue. When using “=“ to test whether two strings are the same, case matters.
Follow us on Twitter @IHSEViews

fox6327
Posts: 4
Joined: Thu Mar 11, 2021 11:01 am

Re: Double looping

Postby fox6327 » Mon Apr 19, 2021 6:27 am

Hi Gareth,
Thank you, it's all good now. It turned out the issue was with the 'endif' part (it should have been 'elseif').

fox6327
Posts: 4
Joined: Thu Mar 11, 2021 11:01 am

Re: Double looping

Postby fox6327 » Mon Apr 19, 2021 6:27 am

Hi Gareth,
Thank you, it's all good now. It turned out the issue was with the 'endif' part (it should have been 'elseif').


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 27 guests