=========================================================================
Date: Fri, 21 Feb 2003 13:48:52 -0500
Reply-To: Kevin Viel <kviel@EMORY.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Kevin Viel <kviel@EMORY.EDU>
Subject: Re: Make directory listing available as a macro variable
Content-Type: text/plain; charset="iso-8859-1"
Rodney,
There is a method for pipes but I do not have my code handy. I
never seems to remember it. However, I do remember some SCL functions
available to the data step:
data _null_;
length list $ 1000;
rc=filename("XL", "C:\Excel");
dirid=dopen("XL");
dcnt=dnum(dirid);
if dcnt>0 then
do i=1 to dcnt;
rd=dread(dirid, i);
if index(rd, ".xls") then
do;
if list=" " then list=rd || " * ";
else list=compbl(list) || trim(left(rd)) || " * " ;
end;
end;
call symput("XL", list);
rc=dclose(dirid);
run;
%put &xl.;
Regards,
Kevin
____________________________________
Kevin Viel
Department of Epidemiology
Rollins School of Public Health
Emory University
Atlanta, GA 30329
----- Original Message -----
From: "rpresley" <rpresley@GMCF.ORG>
Newsgroups: bit.listserv.sas-l
To: <SAS-L@LISTSERV.UGA.EDU>
Sent: Friday, February 21, 2003 12:35 PM
Subject: Make directory listing available as a macro variable
> SAS 8.2, Windows.
>
> We have directories such as c:\excel .
>
> I want to be able to include the names of the files in this directory into
a
> SAS macro variable so I can then use that macro variable in a program that
> imports all of the excel files in a directory. It looks like I might be
> able to use a pipe command to get the dir listing into a flat file but I
> have not figured this out yet.
>
> Any help would be appreciated.
>
> Thanks,
>
> Rodney
>
> Rodney J. Presley, PhD
> Director of Data Analysis
> Georgia Medical Care Foundation
> 57 Executive Park South, NE
> suite 200
> Atlanta, GA 30329-2224
>
> 404-982-7574
> 404-982-7592 fax
>
|