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 (July 2007, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 31 Jul 2007 13:02:55 +0000
Reply-To:     toby dunn <tobydunn@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         toby dunn <tobydunn@HOTMAIL.COM>
Subject:      Re: The commented codes in a macro still run
Comments: To: gimmytang@GMAIL.COM
In-Reply-To:  <1185885545.926512.147990@w3g2000hsg.googlegroups.com>
Content-Type: text/plain; format=flowed

GImmy ,

Ill skip the Macro design issues and the resulting data step code issues since we need for the time being to focus on a more basic issue.

In teh macro facility there are 2 types of comments the /* <some text */ and %* <some Text> ; I would say the easiest and safest to use in a %Macro is the %* <text> ; form I say this because you can have some issues with commenting when you use /* <text here> */.

The *<Text> ; is only valid in open code. This explains why you see some of your macro variables getting resolved. YOu havent commented them out from the macro facility.

Just because you comment every thing between the %Macro and %Mend doesnt mean nothing will be put to the log, in fact when SAS compiles the macro definition it will echo the definition to the log.

Toby Dunn

If anything simply cannot go wrong, it will anyway. Murphys Law #2.

The buddy system is essential to your survival; it gives the enemy somebody else to shoot at. Murphys Law #

Tell a man there are 300 billion stars in the universe and he'll believe you. Tell him a bench has wet paint on it and he'll have to touch to be sure. Murphys Law #9

From: Gimmy Tang <gimmytang@GMAIL.COM> Reply-To: gimmytang@GMAIL.COM To: SAS-L@LISTSERV.UGA.EDU Subject: The commented codes in a macro still run Date: Tue, 31 Jul 2007 12:39:05 -0000

Hi all, I wrote a macro that can do somthing. The funny thing is that if I put all the codes in this macro as comments, it runs as if these codes were actually executed. The macro is put below. As you can see, all the lines except the header and end are commented and there should be NO output in the log window. However each time I submit this script the lines of ''%put &numfiles'' and ''%put &filename1'' are read and the results will be written in the log window. Can anyone kindly bring some idea of this happening? Thanks! gim

%let directory = r:\sas\ncaa; %macro getit; /* Initialize data set that will contain all files in long form */ *data NCAA.Allsheets; *run;

*%let filrf=mydir; *%let rc=%sysfunc(filename(filrf,&directory)); *%let did=%sysfunc(dopen(&filrf)); *%let lstname=; *%let numfiles=%sysfunc(dnum(&did)); *%put &numfiles;

* %if &numfiles > 0 %then %do; * data one; * length filename filename2 filenamem $100; * %do i = 1 %to &numfiles; * filename="%sysfunc(dread(&did,&i))"; * filename2="abcd"; *%let filename1=%sysfunc(dread(&did,&i)); *%put &filename1; *filenamem=&filename1; /*call execute('%makeallsheets('||"&i"||','|| filename||');');*/ * output; * %end; * run; * %end; /* %let rc=%sysfunc(dclose(&did));

data NCAA.Allsheets; set NCAA.Allsheets; if _n_ ne 1; run;

proc print;run; */ %mend getit; %getit;

_________________________________________________________________ http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_2G_0507


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