Unable to refer correctly to a cell

For questions regarding programming in the EViews programming language.

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

jsteffens
Posts: 3
Joined: Mon Feb 01, 2016 6:10 am

Unable to refer correctly to a cell

Postby jsteffens » Mon Feb 01, 2016 6:25 am

Dear all,

I need help to refer to a certain cell. In my regression I refer to a series named e.g. AM, this value is stored in a svector names2. The svector contains a name of a serie which should be included, e.g. the first 10 values are AM then the next 10 are AJ etc.
This all works without a problem, however AJ contains some NA which causes an error. Therefore I included an if loop which should check whether a certain value in AJ is not NA. The data is time series data and some data has a later starting point which is causing the problem.
The problem is this line of code: if (@isna(@{yss2}.(!i))=0). It should check whether e.g. AJ(13) is not NA (Depending on both loops obviously). I am using EViews 8.

If someone could help solving or circumventing this problem it would be much appreciated. (code is below)

!window = 72


!length = @obsrange
matrix(!length-!window,90) AICvalues
matrix(!length-!window,90) BICvalues
matrix(!length-!window,90) AdjR2values

for !j = 1 to 90
string yss= names(!j,1)
string yss2= names2(!j,1)
for !i = 1 to !length-!window
smpl @first+!i-1 @first+!i+!window-2

if (@isna(@{yss2}.(!i))=0)

equation temp.ls {yss} C m10 m3 {yss2}
temp.fit(f=na) ERPf
AICvalues(!i,!j)=temp.@aic
BICvalues(!i,!j)=temp.@schwarz
AdjR2values(!i,!j)=temp.@rbar2
endif

next
next

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

Re: Unable to refer correctly to a cell

Postby EViews Gareth » Mon Feb 01, 2016 9:10 am

This is a little confusing.

YSS is a string. Strings don't have NAs. They can have missing (i.e. they're empty). Or, I suppose, they can contain the text "NA". Which is the case with you?

jsteffens
Posts: 3
Joined: Mon Feb 01, 2016 6:10 am

Re: Unable to refer correctly to a cell

Postby jsteffens » Tue Feb 02, 2016 5:41 am

YSS2 is indeed a string. However it contains text referring to a certain series in my workfile. Thus {yss2} means it will use e.g. AJ (which is a time series variable) in the regression below. AJ is the series which contains numerical values and hence can also contain NA. This is what i need to check with the if loop or in some other way.

I appreciate the help!

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

Re: Unable to refer correctly to a cell

Postby EViews Gareth » Tue Feb 02, 2016 10:02 am

Then you can do something like:

Code: Select all

if (@isna({yss2}(!i))=0)

jsteffens
Posts: 3
Joined: Mon Feb 01, 2016 6:10 am

Re: Unable to refer correctly to a cell

Postby jsteffens » Wed Feb 03, 2016 6:30 am

Unfortunately i still get a syntax error.
I have included the workfile and the program, maybe that helps.
Thanks in advance!
Attachments
eviews.prg
Program
(525 Bytes) Downloaded 186 times
returns.wf1
Workfile/data
(1.37 MiB) Downloaded 133 times

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

Re: Unable to refer correctly to a cell

Postby EViews Gareth » Wed Feb 03, 2016 9:26 am

Code: Select all

if (@isna({yss2}(!i))=0) then


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest