1

in windows SAS, how to read the file loaded recently in particular path. as i am accing from a path having lot of files , so it should pick a file having the latest data loaded in that path

Fionnuala
  • 90,370
  • 7
  • 114
  • 152
naren
  • 11
  • 1

1 Answers1

2

If you have non-SAS files in the destination directory, you can pipe a command such as dir <your directory> /od /b to a data as illustrated in this question.

If all the files are SAS datasets, create a libref to the directory and try

proc sql noprint;
    select 
        memname,
        crdate
    into 
        :newestdata,
        :createdate
    from
        dictionary.tables 
    where
        libname=upcase("<your libname>")
    having
        crdate=max(crdate);
quit;
%put &newestdata;
%put &createdate;

Unless there are data sets which have the exact same creation time stamp, the &newestdata and &createdate macro variables should contain the name and creation date of the latest data set.

Community
  • 1
  • 1
Ville Koskinen
  • 1,266
  • 2
  • 15
  • 20