Page 1 of 1

if statement - syntax error

Posted: Fri Mar 27, 2009 1:41 pm
by cap
Any idea why I get a syntax error here?

As far as I can tell this looks exactly like what is on page 611 of User's Guide I.

in the command line, I enter: run myprog xyz

where myprog.prg is the following
----------------------------


if %0 = "xyz"

!j =5

else

!j=10

endif

----------------------------


and this produces the error message: Syntax error in "IF %0="XYZ""


-cap

Re: if statement - syntax error

Posted: Fri Mar 27, 2009 1:46 pm
by EViews Gareth
You're missing a then

Code: Select all

if %0 = "xyz" then !j =5 else !j=10 endif

Re: if statement - syntax error

Posted: Fri Mar 27, 2009 1:54 pm
by cap
ah, yes, blunder ...thanks very much!