views:

39

answers:

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

+2  A: 

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.

Ville Koskinen