IF statement problem

For questions regarding programming in the EViews programming language.

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

00tailor
Posts: 3
Joined: Sat Jul 24, 2010 1:44 pm

IF statement problem

Postby 00tailor » Sat Jul 24, 2010 2:10 pm

Hi,

would you please help me to find a cause for the following error: else statement unterminated at "if y(!i)<0 then" in the following code. This is actually a program for a value-at-risk (risk metrics) computation for long and short trading positions, thus a need for the if statement:

Code: Select all

smpl 1 1632 series y1= 100*log(sp500/sp500(-1)) scalar nobs = 1632 scalar nw = 1000 matrix(1632,1) results for !i = nw+1 to nobs smpl !i-nw !i equation eq_y1.arch(1,1,integrated,m=2000,h) y1 c smpl !i 1632 if y1(!i)<0 then smpl !i+1 !i+1 eq_y1.forecast y1f var genr meant=@mean(y1) genr vatr=meant-2,32635*sqr(var) smpl !i+1 1632 results(!i+1,1)=@elem(vatr, @otod(!i+1)) else smpl !i+1 !i+1 eq_y1.forecast y1f var genr meant=@mean(y1) genr vatr=meant+2,32635*sqr(var) smpl !i+1 1632 results(!i+1,1)=@elem(vatr, @otod(!i+1)) next
thank you in advance
P.S. program run by the version 6

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

Re: IF statement problem

Postby startz » Sat Jul 24, 2010 3:41 pm

You left off the

Code: Select all

endif

00tailor
Posts: 3
Joined: Sat Jul 24, 2010 1:44 pm

Re: IF statement problem

Postby 00tailor » Sat Jul 24, 2010 3:54 pm

Thanks a lot!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests