Page 1 of 1

Double looping

Posted: Thu Mar 11, 2021 11:19 am
by fox6327
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...

Re: Double looping

Posted: Thu Mar 11, 2021 11:30 am
by EViews Gareth
Probably a case issue. When using “=“ to test whether two strings are the same, case matters.

Re: Double looping

Posted: Mon Apr 19, 2021 6:27 am
by fox6327
Hi Gareth,
Thank you, it's all good now. It turned out the issue was with the 'endif' part (it should have been 'elseif').

Re: Double looping

Posted: Mon Apr 19, 2021 6:27 am
by fox6327
Hi Gareth,
Thank you, it's all good now. It turned out the issue was with the 'endif' part (it should have been 'elseif').