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 08:54:34 -0400
Reply-To:     WHITLOI1 <WHITLOI1@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         WHITLOI1 <WHITLOI1@WESTAT.COM>
Subject:      Re: Local macro variables
Comments: To: Zdenek Seidl <SeidlZ@TESCOSW.CZ>
Content-Type: text/plain; charset=US-ASCII

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

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 <whitloi1@westat.com>


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