| Date: | Wed, 2 Oct 2002 11:00:43 +0200 |
| Reply-To: | Jim Groeneveld <J.Groeneveld@ITGROUPS.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Jim Groeneveld <J.Groeneveld@ITGROUPS.COM> |
| Subject: | Re: Multiple file read in DIFFERENT subdirs? |
|
| Content-Type: | text/plain; charset="iso-8859-1" |
Hi Poul,
Not that way, I think, in Windows, because directories do not support
wildcards. But you may read all files using an unnamed PIPE construct.
Untested code is:
%LET SubDir = N:\Data;
%LET WildCard = *.dat;
FILENAME AllFiles PIPE "DIR /B /ON /S &SubDir.\&WildCard";
DATA Combined;
LENGTH FileName $100;
INFILE AllFiles;
INPUT FileName $;
INFILE FileName FILEVAR=FileName END=EoF;
DO UNTIL (EoF);
INPUT x y z;
OUTPUT; * explicit write within data step loop;
END;
RUN;
Regards - Jim.
--
Y. (Jim) Groeneveld, MSc IMRO TRAMARKO tel. +31 412 407 070
senior statist./data man. P.O. Box 1 fax. +31 412 407 080
J.Groeneveld@ITGroups.com 5350 AA BERGHEM, NL www.imrotramarko.com
My computer does what I tell it to do; I do tell myself to believe that.
Notice of confidentiality: this e-mail may contain confidential information
intended for the addressed recipient only.
If you have received this e-mail in error please delete this e-mail and
please notify the sender so that proper delivery
can be arranged.
> -----Original Message-----
> From: Poul Ravn Sørensen [SMTP:poulravn1@HOTMAIL.COM]
> Sent: Wednesday, October 02, 2002 10:22 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Multiple file read in DIFFERENT subdirs?
>
> Hi guys,
>
> is it possible to read, in one datastep, ALL files with a specific
> extension
> (eg. *.dat or *.txt)? I am thinking of something like:
>
> data test;
> infile 'n:\data\*.dat*
> input x y z;
> run;
>
> BUT: I want further to read all the *.dat files in subdirectories under
> n:\data.
>
> I know this has been mentioned before, but I am not sure whether it
> covered
> also different subdirs, - - - and I cannot find the post.
>
> So, thanks in advance
>
> Poul R S
|