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 (September 2007, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
Comments:   To: sas-l@uga.edu
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.


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