Date: Tue, 22 Oct 2002 11:25:39 -0400
Reply-To: "John J Genzano, III" <jgenzano@GENZANO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "John J Genzano, III" <jgenzano@GENZANO.COM>
Subject: Re: Macro variable in Macro Name
Content-Type: text/plain; charset="us-ascii"
Your problem is not because of the variable name. There is a semi-colon
missing somewhere in the code.
John J Genzano, III
Genzano Software Consulting
SAS Certified Professional, V6
"Anyone who cannot cope with mathematics is not fully human. At best he
is a tolerable subhuman who has learned to wear shoes, bathe, and not
make messes in the house." - Robert A. Heinlein
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Sent: Tuesday, October 22, 2002 11:12 AM
Subject: Macro variable in Macro Name
I would like to be able to name a macro, according to the value of a
macro variable that is defined before the macro code. Here is a very
abbreviated version of the code I tried.
%let suffix = ABC;
/* SAS code; */
The intention is the the compiled macro would have the name thatABC, and
then the statement %thatABC would invoke the macro. But the SAS
macro compiler balks, and the log contains the messages:
ERROR: Expected semicolon not found. The macro will not be compiled.
ERROR: A dummy macro will be compiled.
According to the SAS MACRO manual (version 8, page 23), "You can use
these [macro variable] references anywhere in a SAS program". I have
learned to take this statement with a grain of salt, and the above
situation seems to be another example. Any suggestions would be
One might wonder why I would want to do such a thing. The reason is
that I have a bunch of files which perform the same logical operation,
although the specific macro code is quite different from file to file.
(Actually about 10 different algorithms for data imputation, and I want
details of the specific algorithm to remain hidden in the individual
files.) I want to preserve as much parallelism as possible, and I
successfully use the suffix in titles, variable labels, SAS data set
names, and external file names. I would like to to be able to do the
same thing with the macro names, but have come to the above described