Date: Thu, 5 Jun 2008 12:46:32 -0400
Reply-To: Ya Huang <ya.huang@AMYLIN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ya Huang <ya.huang@AMYLIN.COM>
Subject: Delete a temp macro inside another macro (Was Re: Macro,
only for the sake of modular programming?
Hi there,
First of all, I would like to thank everyone who responded my previous
post "Macro, only for the sake of modular programming?", your comments
are all very helpful.
Now I have a new question. Not sure if this is a good idea. I want to
define a small macro 'in' inside another macro 'out'. 'in' will be called
multiple times inside 'out', at the end of the macro 'out', I use proc
catalog to delete the macro entry 'in'. It seems to work fine, except
that there is a note "NOTE: Statements not processed because of errors
noted above.". I'm not sure what does it mean.
Any comments?
Thanks
Ya
--------------
1 %macro out;
2 %* macro in will be used multiple times, then delete;
3 %macro in;
4 %put i am in;
5 %mend in;
6
7 %put i am out;
8 %in;
9 %in;
10
11 %* delete macro in;
12 proc catalog catalog=work.sasmacr;
13 delete in / et=macro;
14 run;
15
16 %mend out;
17
18 options mprint;
19 %out;
i am out
i am in
MPRINT(OUT): ;
i am in
MPRINT(OUT): ;
MPRINT(OUT): proc catalog catalog=work.sasmacr;
MPRINT(OUT): delete in / et=macro;
MPRINT(OUT): run;
NOTE: Deleting entry IN.MACRO in catalog WORK.SASMACR.
NOTE: SCL source line.
20 %in;
-
180
WARNING: Apparent invocation of macro IN not resolved.
NOTE: The previous statement has been deleted.
ERROR 180-322: Statement is not valid or it is used out of proper order.
21
22 %out;
i am out
i am in
MPRINT(OUT): ;
i am in
MPRINT(OUT): ;
NOTE: Statements not processed because of errors noted above.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE CATALOG used:
real time 0.01 seconds
cpu time 0.01 seconds
MPRINT(OUT): proc catalog catalog=work.sasmacr;
MPRINT(OUT): delete in / et=macro;
MPRINT(OUT): run;
NOTE: Deleting entry IN.MACRO in catalog WORK.SASMACR.