| Date: | Wed, 5 May 2004 10:17:21 -0700 |
| Reply-To: | Dale McLerran <stringplayer_2@YAHOO.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Dale McLerran <stringplayer_2@YAHOO.COM> |
| Subject: | Re: Appending Many Files |
| In-Reply-To: | <c7b1sd$19v7t$1@ID-168040.news.uni-berlin.de> |
| Content-Type: | text/plain; charset=us-ascii |
|---|
I agree that it is useful to employ a program to write the code
that would set these 5000 or so files. I also like Richards first
step where he uses the SQL dictionary.tables to construct a list
of the datasets which need to be employed for the set operation.
I think there is a simpler solution for writing the code that
executes the set operation. I would employ CALL EXECUTE in a
_null_ datastep to place code in a stack to be executed after the
_null_ datastep completes. I would note that only a single _null_
datastep is needed.
data _null_;
set listoftables end=end;
if _n_=1 then do;
call execute("data stacked;");
call execute("set");
end;
call execute(compress(library || '.' || memname));
if end then do;
call execute(";");
call execute("run;");
end;
run;
HTH,
Dale
--- "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM> wrote:
> SUBSCRIBE SAS-L Anonymous. wrote:
> > Dear All:
> >
> > I have about 5000 SAS data files, 4 for each day, and going
> from
> > Jan 1999 to 2003 Dec...The dates on these files are in the format
> > f20000703_110000; f20000703_120000; f20000703_130000; and so on...
> > f20000703 stands for the date -- July 3, 2000; and the 110000
> stands
> > for the hour. I want to merge all of these files to create one
> > dataset. Each of the files have the same variables and have the
> same
> > format....Can Somebody please help me.
>
> Due to number of table, I would write a program that writes the
> program.
> untested...
>
> proc sql;
> create tables listoftables as select memname from
> dictionary.tables where
> libname = "<libname>"
> and memname like 'f%'
> ;
>
> filename stack catalog 'work.merge.ftables.source';
>
> data _null_;
> set listoftables end=end;
> file stack;
> if _n_ = 1 then put 'set';
> put libname '.' +(-1) libname 'in=(_' _n_ ')';
> if end then put ';'
> run;
>
> data _null_;
> set listoftables;
> file stack mod;
> put 'if _' _n_ 'then source="' libname '.' +(-1) memname '"; else';
> if end then put ';'
> run;
>
> data stacked;
> %include stack;
> run;
>
> filename stack;
>
> --
> Richard A. DeVenezia
> http://www.devenezia.com/downloads/sas/macros/?m=xmlib
=====
---------------------------------------
Dale McLerran
Fred Hutchinson Cancer Research Center
mailto: dmclerra@fhcrc.org
Ph: (206) 667-2926
Fax: (206) 667-5977
---------------------------------------
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover
|