Date: Tue, 7 Aug 2007 16:56:59 -0700
Reply-To: Richard <richard.hockey@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Richard <richard.hockey@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: Returning logical filename when using wildcards w/ INFILE
In-Reply-To: <7367b4e20708071513o415e3c6em56b018dc2a9e8c2b@mail.gmail.com>
Content-Type: text/plain; charset="us-ascii"
On Aug 8, 8:13 am, datan...@GMAIL.COM ("data _null_;") wrote:
> You need the FILENAME infile option. You may also want to learn about
> EOV useful when reading from infile using wildcards.
>
> Consider this example.
>
> filename IN1 '.\*.log';
> data work.test;
> attrib filename fn length=$256;
> retain filename;
> infile in1 filename=fn eov=eov length=l;
> input line $varying200. l;
> if _n_ eq 1 or eov then do;
> filename = fn;
> eov = 0;
> end;
> run;
> proc print;
> format line $10.;
> run;
>
> On 8/7/07, drjaws <jstanme...@gmail.com> wrote:
>
> > Hello,
>
> > Can somebody please remind me how to programmatically return, in the
> > data step, the logical filename (and path if possible) of the
> > currently-processing INFILE when using wildcards. For example, if I
> > use the following statement:
>
> > FILENAME IN1 "J:\Data\0706\*0706*";
>
> > DATA TEST; INFILE IN1 LRECL=705 PAD TRUNCOVER;
> > * blaa blaa blaa;
> > RUN;
>
> > The log tells me (for the first of many files):
>
> > NOTE: The infile IN1 is:
> > File Name=J:\Data\0706\AE07061,
> > File List=J:\Data\0706\*0706*,RECFM=V,
> > LRECL=705
>
> > How can I get that actual file name i (AE07061) into a variable?
>
> > I am hoping to use wildcards and not a directory dump into an INFILE
> > statement with CARDS or DATALINES.
>
> > Thanks in advance,
> > John
You will find the name of the infile in the automatic SAS view
sashelp.vextfl
R
|