Date: Tue, 7 Aug 2007 17:13:43 -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: Returning logical filename when using wildcards w/ INFILE
In-Reply-To: <1186523391.170794.230740@57g2000hsv.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
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 <jstanmeyer@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
>
|