@wlookup with loop variable

For questions regarding programming in the EViews programming language.

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

mtimmes
Posts: 6
Joined: Thu Nov 29, 2012 3:35 pm

@wlookup with loop variable

Postby mtimmes » Thu Nov 29, 2012 3:45 pm

Hello - sorry if this a very basic question...

I'm trying to nest two for loops, where the inner loop selects a group of variables based on the value of the outer loop (in this case, country on the outer, product on the inner).
Unfortunately, I can't seem to make the line %prod = @wlookup(@wunion("in*",{%z})) work.
Any suggestions or advice appreciated, thanks.
----------------------------------------------------
%cntry = "be de uk"
for %z {%cntry}
%prod = @wlookup(@wunion("in*",{%z}))
for %y {%prod}
equation eq_{%y}.stepls {%y} econs
eq_{%y}.forecast {%y}_ls
next
next
-------------------------------------------------

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

Re: @wlookup with loop variable

Postby EViews Gareth » Thu Nov 29, 2012 5:30 pm

Can't you just use:

Code: Select all

%cntry = "be de uk" for %z {%cntry} %prod = @wlookup("in*"+%z) for %y {%prod} equation eq_{%y}.stepls {%y} econs eq_{%y}.forecast {%y}_ls next next

mtimmes
Posts: 6
Joined: Thu Nov 29, 2012 3:35 pm

Re: @wlookup with loop variable

Postby mtimmes » Fri Nov 30, 2012 12:37 am

Perfect, thank you for the help and the quick response.

Ale_lanza
Posts: 5
Joined: Sat Nov 15, 2014 6:54 am

Re: @wlookup with loop variable

Postby Ale_lanza » Tue Jan 13, 2015 2:57 am

for !%y = bah kuw oma qat sau uni
for !%x = _co2 _pop _gdp _tpes _tfc

genr l%y%x= log(%y%x)

next
next


a very basic question....but It does not work...

Thanks

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

Re: @wlookup with loop variable

Postby EViews Gareth » Tue Jan 13, 2015 9:08 am

Code: Select all

for %y bah kuw oma qat sau uni for %x _co2 _pop _gdp _tpes _tfc genr l{%y}{%x}= log({%y}{%x}) next next


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests