if statement

For questions regarding programming in the EViews programming language.

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

nesheus
Posts: 34
Joined: Tue Oct 26, 2010 11:55 am

if statement

Postby nesheus » Mon Nov 15, 2010 9:01 am

I keep getting errors for the If statement, can you see why? thanks a lot.

smpl 1990Q1 @last

for !j=1 to 43
smpl 1990Q1 1999Q4+!j-1
if @last<2008Q4 then equation eqalum01_!j.ls d(lalum) c ma(1) dum2 dum3 dum4
endif

else equation eqalum01_!j.ls d(lalum) c ma(1) dum2 dum3 dum4 dum08Q4

smpl 1999Q4+!j 1999Q4+!j+19
forecast alum_01_!j
series mse01_!jalum = (alum_01_!j - lalum)^2
next

startz
Non-normality and collinearity are NOT problems!
Posts: 3797
Joined: Wed Sep 17, 2008 2:25 pm

Re: if statement

Postby startz » Mon Nov 15, 2010 9:03 am

endif needs to be after the else

nesheus
Posts: 34
Joined: Tue Oct 26, 2010 11:55 am

Re: if statement

Postby nesheus » Mon Nov 15, 2010 9:06 am

thanks. I corrected it but I still get an error on the if statement.

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

Re: if statement

Postby EViews Gareth » Mon Nov 15, 2010 9:08 am

You're missing a then statement

nesheus
Posts: 34
Joined: Tue Oct 26, 2010 11:55 am

Re: if statement

Postby nesheus » Mon Nov 15, 2010 9:12 am

I even put the equation after else to the next line but I still get an error. Is the "@last<2008Q4" correct?
Here is my if statement,

if @last<2008Q4 then
equation eqalum01_!j.ls d(lalum) c ma(1) dum2 dum3 dum4

else
equation eqalum01_!j.ls d(lalum) c ma(1) dum2 dum3 dum4 dum08Q4
endif

please help, I am stuck and cannot see why!

thanks

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

Re: if statement

Postby EViews Gareth » Mon Nov 15, 2010 10:07 am

No, @last cannot be used like that.

nesheus
Posts: 34
Joined: Tue Oct 26, 2010 11:55 am

Re: if statement

Postby nesheus » Mon Nov 15, 2010 10:10 am

any recommendation on what I need to do then?
thanks

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

Re: if statement

Postby EViews Gareth » Mon Nov 15, 2010 10:30 am

It isn't clear what you're trying to do.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests