looping to create series names

For questions regarding programming in the EViews programming language.

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

eviewscg
Posts: 7
Joined: Mon Feb 09, 2009 7:09 am

looping to create series names

Postby eviewscg » Mon Feb 09, 2009 7:29 am

Hi,
I am trying to to make a loop where the name of the series is looped by an alpha series for the series names and a group for definition of the series. I can get the second half of this to work, but I am unable to find a way for the series names themselves to loop. Basically, I want to create a bunch of series prwds_*, prwdh_*, etc where * is iso country codes for about 62 countries. Here is an example of what I am trying:

for !j=1 to 62
series prpws_isocode(!j)= prpws_usd(!j) *xr_us(!j)
series prpwh_isocode(!j)= prpwh_usd(!j) *xr_us(!j)
series prchs_isocode(!j)= prchs_usd(!j) *xr_us(!j)
series prchh_isocode(!j)= prch_usd(!j) *xr_us(!j)

where isocode is my alpha series containing br, cl, etc
prpws_usd is a group containing pws_br, pws_cl, etc
xr_us is a group containing xrbrus, xrclus, etc
and the groups are all alphabatized by the country code, so the same element (ex: 3rd) in each group (or isocode series) all refer to the same country

Obviously, I know I can write out all 248 (62*4) series names by hand and just loop for the RH side, but I would really prefer to avoid this at all costs from both a time and an ability to change easily standpoint. Thanks for any help!

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

Re: looping to create series names

Postby EViews Gareth » Mon Feb 09, 2009 9:07 am

Code: Select all

for !j=1 to 62 %name = "prpws_" + isocode(!j) series %name = prpws_usd(!j) *xr_us(!j)
Or something along those lines...

eviewscg
Posts: 7
Joined: Mon Feb 09, 2009 7:09 am

Re: looping to create series names

Postby eviewscg » Mon Feb 09, 2009 9:17 am

Thanks a lot! I will give that a try.

eviewscg
Posts: 7
Joined: Mon Feb 09, 2009 7:09 am

Re: looping to create series names

Postby eviewscg » Mon Feb 09, 2009 9:33 am

Using the code you suggested, I am not getting the error:

Can not assign string expression to numeric variable in "SERIES %NAME =PRPWS_USD(1)*XR_US(1)"


Any suggestions?

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

Re: looping to create series names

Postby EViews Gareth » Mon Feb 09, 2009 9:56 am

Sorry, forgot the braces:

series {%name} = ....

eviewscg
Posts: 7
Joined: Mon Feb 09, 2009 7:09 am

Re: looping to create series names

Postby eviewscg » Mon Feb 09, 2009 10:03 am

Thank you very much! I have it working now. Much appreciation!!!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest