Date: Thu, 29 May 2008 16:02:03 -0500
Reply-To: "data _null_," <datanull@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "data _null_," <datanull@GMAIL.COM>
Subject: Re: Excel Import Question
In-Reply-To: <AC8B27AA4545474BB8F063FDFE5F2C5503FBF1FF@GISDSERV03.geneseeisd.local>
Content-Type: text/plain; charset=ISO-8859-1
This does PROC IMPORT code gen for the XLS files in a directory.
Other methods might be more appropriate.
filename ft35f001 'path to xls files(directory name)';
filename ft35f002 temp;
data _null_;
file ft35f002;
length path command datafile out $256;
path = pathname('FT35f001');
command = catx(' ','dir /b',cats(quote(trim(path)),'\*.xls'));
infile dummy pipe filevar=command end=eof;
do until(eof);
input;
putlog _infile_;
datafile = catx('\',path,_infile_);
out = scan(_infile_,1,'.');
put 'PROC IMPORT';
put +3 DATAFILE=:$quote300.;
put +3 OUT= 'DBMS=excel;';
put +3 'run;';
end;
run;
%inc ft35f002 / source2;
On 5/29/08, Treder, David <dtreder@geneseeisd.org> wrote:
>
>
>
>
> Is there a way to import multiple excel files from a single folder, as
> one can do with "*" in an infile statement? Something like:
>
>
>
> PROC IMPORT
>
> DATAFILE= 'c:\datafile\*.xls'
>
> OUT = a1
>
> DBMS=excel ;
>
> run; quit;
>
>
>
> (which, of course, doesn't work)
>
>
>
> Thanks for any suggestions,
>
> Dave
>
>
>
> Scanned by GenNET AV out
>
|