for loop and group

For questions regarding programming in the EViews programming language.

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

Katjes
Posts: 56
Joined: Thu Oct 02, 2008 5:46 am

for loop and group

Postby Katjes » Tue May 19, 2009 2:48 pm

Hi, assuming that I define in for-loop several procedures. Then I want to group the outcome, including all countries as in the for-loop
simple example:
for %c USA GER
genr yoy_{%c}= GDP_{%c}-GDP_{%c}(-1)
next

and the next step should be something like:
group GDP GDP_{%c}
where all series defined in %c should be included, hence group GDP GDP_USA GDP_GER

Do you have some suggestions?

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

Re: for loop and group

Postby EViews Gareth » Tue May 19, 2009 2:58 pm

Not sure I follow exactly, but I think this is what you want:

Code: Select all

group GDP

for %c USA GER
genr yoy_{%c}= GDP_{%c}-GDP_{%c}(-1)
gdp.add gdp_{%c}
next

Follow us on Twitter @IHSEViews

Katjes
Posts: 56
Joined: Thu Oct 02, 2008 5:46 am

Re: for loop and group

Postby Katjes » Tue May 19, 2009 2:59 pm

Many thanks!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 21 guests