| Date: | Tue, 4 Sep 2007 13:51:43 -0700 |
| Reply-To: | z <gzuckier@SNAIL-MAIL.NET> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | z <gzuckier@SNAIL-MAIL.NET> |
| Organization: | http://groups.google.com |
| Subject: | my macro needs a time machine |
|
| Content-Type: | text/plain; charset="iso-8859-1" |
|---|
I have a big chunk of boilerplate code defined as a macro variable,
for consistency and ease of maintenance, that gets used in several
steps. For instance, (simplified for clarity),
%let boilerplate =
(select id, count(*) as occurrences from
id_list
where age >= &startage.
group by id)
;
And, when it gets used,
%macro firststuff(startage=,outfile=);
proc sql;
create table &outfile. as
select a.*, b.occurrences from
stuff a,
&boilerplate. b
where a.id = b.id;
%mend;
%macro secondstuff(startage=,outfile=);
proc sql;
create table &outfile. as
select a.*, b.occurrences from
otherstuff a,
&boilerplate. b
where a.id = b.id;
%mend;
etc.
so that I can run
%firststuff(startage=18,outfile=stuff18);
%secondstuff(startage=18,outfile=otherstuff18);
%firststuff(startage=90,outfile=stuff90);
%secondstuff(startage=90,outfile=otherstuff90);
etc.
Of course, what happens is that the %let gives me a warning
WARNING: Apparent symbolic reference STARTAGE not resolved.
since startage isn't defined yet, until the macro gets called later
down; but it works OK.
It runs OK, but it would be nice to get rid of that return code = 1.
Any ideas? TIA.
|