Date: Sat, 3 Dec 2005 13:48:05 -0500
Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@NETSCAPE.NET>
Subject: Re: do loops outside the data step
There is probably an easier way, and the following is definitely untested
code, but if all of your files are already sas files and you are using
Windows, you might be able to use something like:
filename fh pipe 'dir /q c:\data\exposures*';
libname aa 'c:\data';
data filenames (drop=dir);
infile fh lrecl=300 truncover firstobs=6;
input date mmddyy8. @11 time $10. @23 dir $5. @28 size $10.
@38 owner $22. @61 filename $40.;
filename=tranwrd(filename,'.sas7bdat','');
if trim(upcase(dir)) ne '<DIR>' and date ne .;
run;
proc sql noprint;
select filename into :files2read separated by " "
from filenames;
%let stop = &sqlobs;
quit;
%macro combine_the_files;
data All_Files_Combined (drop=acc_yr vcode mod_yr);
%do i = 1 %to &stop;
set aa.%scan(&files2read, &i);
%end;
run;
%mend combine_the_files;
%combine_the_files
Art
---------
"rss" <rslotpole@comcast.net> wrote in message
news:1133630263.030150.204800@z14g2000cwz.googlegroups.com...
> Hi,
>
> we have 10 years of monthly data contained in files. Each month we
> have an exposure file named exposuresyyyymmdd The file's are on the c
> drive at C:\Data. So we have 120 files
>
> exposures19941231
> .
> .
> exposures20041231
>
> As we have learned in the SAS tutorials there is a do loop within the
> data step but how would you create a do loop around the data step so
> that you can load all these files into one giant sas table?
>
> Thanks
>