Looping through groups in a workfile

For questions regarding programming in the EViews programming language.

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

fboehlandt
Posts: 83
Joined: Thu Apr 15, 2010 3:54 am

Looping through groups in a workfile

Postby fboehlandt » Tue Jul 10, 2012 7:46 am

Hi everyone,

Instead of looping through series in a group, I am trying to loop through all groups in a workfile. Something along the lines of:

for !i = 1 to wf.@groupcount
%n=wf.@groupname(!i)
'do something here with %n
next

Is this possible?

Thanks for your reply

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

Re: Looping through groups in a workfile

Postby EViews Gareth » Tue Jul 10, 2012 8:00 am

Code: Select all

%grouplist = @wlookup("*", "group") for %n {%grouplist} ... next

fboehlandt
Posts: 83
Joined: Thu Apr 15, 2010 3:54 am

Re: Looping through groups in a workfile

Postby fboehlandt » Wed Jul 11, 2012 12:40 am

Great, thanks very much. I shall give this a try

fboehlandt
Posts: 83
Joined: Thu Apr 15, 2010 3:54 am

Re: Looping through groups in a workfile

Postby fboehlandt » Wed Jul 11, 2012 9:10 am

Hi Gareth,
I still have a problem with implementation:

This works fine:

Code: Select all

%seriesname = @wlookup("*", "series") for %n {%seriesname} next
This, however, returns "Syntax error in FOR %N"

Code: Select all

%grouplist = @wlookup("*", "group") for %n {%grouplist} next
Any thoughts on this?

Thanks

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

Re: Looping through groups in a workfile

Postby EViews Gareth » Wed Jul 11, 2012 9:12 am

Is your copy of EViews up to date?

fboehlandt
Posts: 83
Joined: Thu Apr 15, 2010 3:54 am

Re: Looping through groups in a workfile

Postby fboehlandt » Wed Jul 11, 2012 9:19 am

Not sure, what version has this increased functionality for @wlookup?

fboehlandt
Posts: 83
Joined: Thu Apr 15, 2010 3:54 am

Re: Looping through groups in a workfile

Postby fboehlandt » Wed Jul 11, 2012 9:25 am

sorry, just ran the update. Working fine now. Should not post questiosn resulting from out-of-date Eview copies. mea culpa
Thanks again

fboehlandt
Posts: 83
Joined: Thu Apr 15, 2010 3:54 am

Re: Looping through groups in a workfile

Postby fboehlandt » Wed Jul 11, 2012 9:44 am

Quick one:

I need to reference the name of the group that is currently selected:

Code: Select all

%grouplist = @wlookup("*", "group") for %n {%grouplist} %string1 = 'here groupname next
Thanks once again

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

Re: Looping through groups in a workfile

Postby EViews Gareth » Wed Jul 11, 2012 9:45 am

um, %n?

fboehlandt
Posts: 83
Joined: Thu Apr 15, 2010 3:54 am

Re: Looping through groups in a workfile

Postby fboehlandt » Wed Jul 11, 2012 9:54 am

Duh! of course, got it now. thanx


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests