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 1998, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 22 Jul 1998 09:22:52 -0400
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
Subject:   Re: Local macro variables
Content-Type:   text/plain; charset=US-ASCII

(This is not a duplicate of a previous message. I say so because it appeared to be rejected by the listserver on that basis.)

Subject: Local macro variables Sumary: CALL EXECUTE can be used to delay macro invocation until after the DATA step has finished. Respondent: Ian Whitlock <>

Several days ago I responded to Seidl Zdenek's <SeidlZ@TESCOSW.CZ> question about why his code was not working without giving a good solution.

> %macro sample; > %local xxx; > data _null_; > call symput("xxx","TEST"); > run; > %put _all_; > %mend sample; > > data _null_; > call execute('%sample;'); > run;

The problem is that %SAMPLE executes, i.e. generates code, during the DATA step. The solution is to delay the invocation of the macro until after the DATA step has finished so that the macro executes in the normal manner.

data _null_; call execute('%nrstr(%sample;)'); run;

With the surrounding %NRSTR the macro facility dumps the macro invocation into the input stack instead of the code generated by the macro.

Ian Whitlock <>

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