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 (October 2000, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 11 Oct 2000 10:07:44 -0700
Reply-To:   "Lund, Pete" <Peter.Lund@CFC.WA.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Lund, Pete" <Peter.Lund@CFC.WA.GOV>
Subject:   Re: Macro name contains a macro variable
Comments:   To: Mike Schexnayder <irmike@LSU.EDU>
Content-Type:   text/plain; charset="iso-8859-1"

Mike- I seem to remember seeing a tech note about this, but I don't have the time to find it now. Here's a solution to the problem that will allow you keep the same structure you had before by simply changing the syntax of the call the TABEx() macros. You need to isolate the % while the TABE&VER resolves. BTW - this approach works in 6.12 and 8.1.

%macro tabe0(parm); %put RUNNING TABE0 - w/ &PARM; %mend;

%macro tabe1(parm); %put RUNNING TABE1 - w/ &PARM; %mend;

%macro tab(ver); %unquote(%nrstr(%%)tabe&ver(0)) /* these are the changes to your */ %unquote(%nrstr(%%)tabe&ver(1)) /* original macro calls */ %mend; %tab(0) %tab(1)

---------------------------------------------------------------------- Pete Lund WA State Caseload Forecast Council 515 15th Ave SE Olympia, WA 98504-0962 (360) 902-0086 voice (360) 902-0084 fax (360) 971-0962 pager peter.lund@cfc.wa.gov ----------------------------------------------------------------------

-----Original Message----- From: Mike Schexnayder [mailto:irmike@LSU.EDU] Sent: Wednesday, October 11, 2000 9:35 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Macro name contains a macro variable

Please comment on this code that worked in version 6.09 but generates an error in version 8.1. The following macro, which worked in version 6.09, contains a macro variable as part of a macro name.. %MACRO TAB(ver); . . . %tabe&ver(0); %end; . . . %tabe&ver(1); %end; . . . %mend tab;

Version 8.1 generates a message saying it cannot find macro tabe.

My solution is

%MACRO TAB(ver); . . . %if "&ver" = "E1" %then %do; %tabe1(0); %end; %else %do; %if "&ver" = "E2" %then %do; %tabe2(0); %end; %else %do; %tabe3(0); %end; %end; . . . %if "&ver" = "E1" %then %do; %tabe1(1); %end; %else %do; %if "&ver" = "E2" %then %do; %tabe2(1); %end; %else %do; %tabe3(1); %end; %end; . . . %mend tab;

Michel Schexnayder Applications Consultant Budget and Planning Louisiana State University Baton Rouge, Louisiana 70803


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