if statement - syntax error

For questions regarding programming in the EViews programming language.

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

cap
Posts: 55
Joined: Fri Oct 17, 2008 11:47 am

if statement - syntax error

Postby cap » Fri Mar 27, 2009 1:41 pm

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

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

Re: if statement - syntax error

Postby EViews Gareth » Fri Mar 27, 2009 1:46 pm

You're missing a then

Code: Select all

if %0 = "xyz" then

!j =5

else

!j=10

endif
Follow us on Twitter @IHSEViews

cap
Posts: 55
Joined: Fri Oct 17, 2008 11:47 am

Re: if statement - syntax error

Postby cap » Fri Mar 27, 2009 1:54 pm

ah, yes, blunder ...thanks very much!


Return to “Programming”

Who is online

Users browsing this forum: EViews Steve and 25 guests