Date: Sun, 7 May 2000 12:13:25 +1200
Reply-To: Don Stanley <don_stanley@XTRA.CO.NZ>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Don Stanley <don_stanley@XTRA.CO.NZ>
Subject: Re: Macro and comment lines question
Content-Type: text/plain; charset=us-ascii
I'd echo this, and also point out that another reason exists for enforcing
/* ... */ comments. The * ... ; syntax is executable. We had a situation
recently where a coder had code like the following::
%let x=1 ;
data _null_ ;
...
She commented out the macro for a test run as follows::
* %let x=1 ;
data _null_ ;
It appears that the macro statement was still compiled inside the executable
comment. Thus the semi-colon was the end of the %let, not the comment. The
comment didn't end until the semi-colon after the null data statement. Our
coder got a lot of Error 180 messages, as data step code was found with no
data step.
When our coder brought the log to me, she had spent some time trying to sort
out why the data step wasn't working -- in the magnitude of hours. I've long
been insistent that people should use /* ... */ comments -- there is one and
only one reason IMHO for not using them, and that is when you want your
comments to appear in the SASLOG. The executable ones will, the /*..*/ ones
will not.
Don
Tom Robinson wrote:
> In article
> <01286C25DDC7D1118EFD00805F9FCEFB0532A87E@cujo.research.aa.wl.com>,
> "Brucken, Nancy" <Nancy.Brucken@WL.COM> wrote:
>
> >Does anyone have any idea why the following piece of macro code works:
>
> Hi Nancy
>
> To expand on the other 2 replies to this: SAS treats an * comment as an
> actual statement - and of course you can't put these between an END and
> an ELSE.
>
> There's at least 4 commenting styles in SAS. I always use /* */. These
> get removed before SAS even sees the code, so you can use this style
> pretty much anywhere. eg, this will work:
>
> if a=2 then /* test for 1+1 */
> put "hi";
>
> But it wouldn't work with an * comment.
>
> One of the other replies mentioned macro comments. I always avoid
> these, again using /* */ instead. Macro comments get upset when you
> have an unmatched quote in them. eg: %* don't run this; will produce
> an error.
>
> Cheers
>
> --
> 8 Bare The Queensland Police Service spent 63% less on their IT
> o-+-o Foot than comparable set-ups in similarly sized organisations
> < > Guru (saving $30 million) and spent $0 on Y2K compliance.
> They run Macs. Of course.
--
Don Stanley, B.SC, Dip O.R.S, MNZCS Director, Sysware Consulting Group
Box 634, Wellington, NEW ZEALAND
http://www.sysware.co.nz
EMAIL:: don_stanley@xtra.co.nz
http://www.geocities.com/don_stanley_nz/don_home.htm
Genealogy:: http://www.geocities.com/don_stanley_nz/family.htm
|