On Aug 7, 10:49 pm, drjaws <jstanme...@gmail.com> wrote:
> Can somebody please remind me how to programmatically return, in the
> data step, the logical filename (and path if possible) of the
> currently-processingINFILEwhen using wildcards. For example, if I
> use the following statement:
> FILENAME IN1 "J:\Data\0706\*0706*";
> DATA TEST;INFILEIN1 LRECL=705 PAD TRUNCOVER;
> * blaa blaa blaa;
> The log tells me (for the first of many files):
> NOTE: TheinfileIN1 is:
> File Name=J:\Data\0706\AE07061,
> File List=J:\Data\0706\*0706*,RECFM=V,
> 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 anINFILE
> statement with CARDS or DATALINES.
> Thanks in advance,
your answer comes from the infile option
you provide a wide enough character variable and input statements
read from the file, the variable name you give will hold that
"external" file name
data sas_prog_names ;
length filen $100 ;
infile '.\*.sas' filename= filen ;
if filen ne lag(filen) ;
filename= filen ;
(hopefully) that creates a dataset of the names of sas program files
in your "current" folder.
I'm not in a position to check, but I expect that like the dos "dir
*.sas /b" command, you may not get paths unless you apply a path in
the command, like
"dir .\*.sas /b"
SASHELP.VEXTFL and dictionary.extfiles only show the position between
steps, whereas the FILENAME= infile option will show you what happens
~during~ the processing of your data step ~~ including indicating the
all of the names you read through one infile.
hope this helps (I haven't seen it covered in earlier responses)