Page 1 of 1

if statement

Posted: Mon Nov 15, 2010 9:01 am
by nesheus
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

Re: if statement

Posted: Mon Nov 15, 2010 9:03 am
by startz
endif needs to be after the else

Re: if statement

Posted: Mon Nov 15, 2010 9:06 am
by nesheus
thanks. I corrected it but I still get an error on the if statement.

Re: if statement

Posted: Mon Nov 15, 2010 9:08 am
by EViews Gareth
You're missing a then statement

Re: if statement

Posted: Mon Nov 15, 2010 9:12 am
by nesheus
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

Re: if statement

Posted: Mon Nov 15, 2010 10:07 am
by EViews Gareth
No, @last cannot be used like that.

Re: if statement

Posted: Mon Nov 15, 2010 10:10 am
by nesheus
any recommendation on what I need to do then?
thanks

Re: if statement

Posted: Mon Nov 15, 2010 10:30 am
by EViews Gareth
It isn't clear what you're trying to do.