Testing for the existence of series in a loop

For questions regarding programming in the EViews programming language.

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

Young
Posts: 8
Joined: Wed Aug 13, 2014 7:46 am

Testing for the existence of series in a loop

Postby Young » Fri Aug 15, 2014 6:43 am

Hello

I have another simple question that will hopefully shed more light on Eviews programming...

I have a list of countries with many time series variables, and I would like to make a new time series by taking the ratio of two of these series. The underlying two series do not exist for some countries, so I would like to skip the countries for which the series do not exist.

I tried the code below, which ran. It created the new series for the countries for which the underlying series existed (good), but it also created new series even for the countries for which the underlying series did not exist (not good). I think this is because the strings (%temp1 and %temp2) are created, so the @isobject tests will always evaluate to "1". I am hung up on the difference between the string (name of the series) and the actual series in the workfile (aud_nor_0_0_0_0 etc) but I don't know how to translate between the two, obviously.

Any help you can provide would be much appreciated.

Thank you


for %a aud cad usd
%temp1=%a + "_nor_0_0_0_0"
%temp2=%a + "_inv_0_0_0_0"
if @isobject(%temp1)=1 and @isobject(%temp2)=1 then
series {%a}_noi_0_0_0_0 = {%a}_nor_0_0_0_0/ {%a}_inv_0_0_0_0
endif
next

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

Re: Testing for the existence of series in a loop

Postby EViews Gareth » Fri Aug 15, 2014 8:16 am

What you have looks fine.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests