Date: Wed, 5 May 2004 11:56:51 -0400
Reply-To: "Lustig, Roger" <roger.lustig@CITIGROUP.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Lustig, Roger" <roger.lustig@CITIGROUP.COM>
Subject: Re: another newbie question / SET
Content-Type: text/plain; charset="iso-8859-1"
Helen:
If you wish to enumerate the five data sets, you need a smaller macro.
Remember: =====> SAS macros write SAS code <=====
That's all they do. What you want is a macro that writes five dataset names. You don't even want to write the whole SET statement--just the stuff between the SET keyword and the semicolon. (So make sure your macro doesn't write semicolons!)
%macro namewriter(lib=work,head=,from=,to=);
%do I=&from %to &to;
&lib..&head.&I
%end;
%mend;
data hcondall;
set
%namewriter(head=helmcond,from=1,to=5)
;
run;
Note that WORK is the default library, but that you can use any other.
Note also that you can mix and match:
data stuff;
set
%namewriter(lib=mydata,head=master,from=1,to=12)
%namewriter(lib=yourdata,head=faster,from=13,to=24)
%namewriter(lib=mydata,head=disaster,from=25,to=36)
;
run;
OK?
Roger
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]On Behalf Of
Dennis, Helen
Sent: Wednesday, May 05, 2004 11:47 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: another newbie question / SET
Thanks so much for your patient help yesterday. Now I am trying to stack five data sets using the SET command, and although I get no error message, I also get no results. Each data set has 10,000 records and 10 variables.Any suggestions?
DATA hcondall;
SET helmcond1 helmcond2 helmcond3 helmcond4 helmcond5;
Run;
I also tried this:
%MACRO appnhelm;
%DO k= 2 %TO 5;
DATA helmdata1;
set helmdata1 helmdata&k;
run;
%END
%appenhelm;
run;
Helen C. Dennis
Education Associate
Assessment and Analysis Group
Delaware Department of Education
P.O. Box 1402
Dover, DE 19903-1402
Tel: (302)739-6700 Fax: (302) 739-3092
email: hdennis@doe.k12.de.us
|