Date: Wed, 19 Sep 2001 15:06:46 -0400
Reply-To: Ian Whitlock <WHITLOI1@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ian Whitlock <WHITLOI1@WESTAT.COM>
Subject: Re: SAS Comments
Content-Type: text/plain; charset="iso-8859-1"
* comment ;
This is a SAS comment statement. This means it is handled by the SAS
compiler. This means that tokens inside may go to the macro facility
before SAS recognizes there is a comment. Consider:
%macro mac (dummy);
data w ; x = 1 ; run ;
*%put NOT OK!!! ;
%mend mac ;
options mprint ;
*%mac(); /* does not execute in open code */
*%put ok; /* does not execute in open code */
%mac() /* when the macro executes the %PUT executes */
data w ; /* this semicolon ended the comment begun in %mac */
error ; /* this is an error because the statement must be
inside a DATA step!!!
no need for a RUN statement since there isn't
Personally I avoid all *comments in macros. I also avoid them in any
code that I may decide to put in a macro. This pretty much means I avoid
unless there is some overriding reason to use them. As statements they get
generated by the mprint and on the log. This could be important enough to
use them in special cases where you want to generate flexible comments or
require comments in the log for documentation purposes.
/* comment */
This comment is recognized throughout the system. I use it almost all
the time. I think these comments are removed at macro compile time.
%* comment ;
This is a macro comment statement. It can only be used inside macros.
The advantage is that it is removed at macro compile time.
comment comment ;
I think this is an older form of *comment. I would not use it.
Others have consider using comments to block out code. I consider this a
dangerous practice which should be extremely limited. I use it in class
to show alternatives, but much prefer to use multiple windows, highlighted
code, macros, %GOTO, and %include to control which code is executed in any
serious work. It is far too important for me to be able to tell the
difference between code and comments to use commenting as a tool for hiding
From: Nick [mailto:nick_s_downie@HOTMAIL.COM]
Sent: Wednesday, September 19, 2001 6:26 AM
Subject: SAS Comments
What is the difference in processing terms between comments such as...
*** this is a comment*** ;
/*** this is another comment ***/
Also - are these treated differently by the macro compiler? I have
seen comments such as..
%*** this is a comment inside a macro ***;
but what is the difference?