LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2004, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 30 Mar 2004 15:53:27 -0500
Reply-To:     Ed Heaton <EdHeaton@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ed Heaton <EdHeaton@WESTAT.COM>
Subject:      Re: Comments in Macros
Comments: To: "" <>
Content-Type: text/plain


This code would not work in a macro and similar non-macro code will not work outside a macro. The problem is that the %ELSE statement must immediately follow the end of the %THEN block. You have a statement between the two, namely the comment statement. You can change it to a comment with /* and */ and it will work.


Edward Heaton, SAS Senior Systems Analyst, Westat (An Employee-Owned Research Corporation), 1600 Research Boulevard, RW-3541, Rockville, MD 20850-3195 Voice: (301) 610-4818 Fax: (301) 610-5128

-----Original Message----- From: Daniel Normolle [mailto:monk@UMICH.EDU] Sent: Tuesday, March 30, 2004 3:25 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Comments in Macros


Is there any reason the following code should not run? SAS (V8.2 on Red Hat 9) complains to me that the first %if-%then block is not closed. Take the comment out, comment the comment out with /* ... */ or change * to %* in the comment and it works. I'm happy to do that, but I'd like to understand the error of my ways...Thanks! dpn

%macro badcom;

%let x=1; %if &x=1 %then %do; %put This should print; %end;

*------This comment is the problem;

%else %do; %put This should not; %end;

%mend badcom;


Back to: Top of message | Previous page | Main SAS-L page