|
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
|