*
;  /*
Subject:      Re: getting date of file update/creation
From:         Bernard Tremblay 
Date:         1997/01/31
Newsgroups:   comp.soft-sys.sas

Hi,

        I knows not how to obtain the date from a SAS infile statement.
But, you sure can use a pipe to read a UNIX "ls -l filename" result...
        ...
NB:     The output of the command "ls -l filename" may differ from one
        version of UNIX to another, so you may have to modify the macro!


Here is an example I'm recycling from stuff used for something else:   */

%macro filedte(file);
%*;
  filename dirlst pipe "ls -l &file" ;
  data _null_ ;
       infile dirlst length=ln end=eof;
       input line $varying200. ln;
       format access $10. owner $8. group $4. file  $45. size 10.
              datec datetime. mon $3. day $2. yt $5.;
       access=scan(line,1,' ');
       owner=scan(line,3,' ');
       group=scan(line,4,' ');
       size=input(scan(line,5,' '),10.);
       mon=scan(line,6,' ');
       day=scan(line,7,' ');
       yt=scan(line,8,' ');
       if index(yt,':')>0
       then
            datec=input(day||mon||trim(aaaa)||':'||yt,datetime16.);
       else
            datec=input(day||mon||trim(yt)||':00:00',datetime16.);
       file=scan(line,9,' ');

       ext=trim(reverse(scan(reverse(file),1,'.')));

       /* If all you need is a date, you may put it in a macro variable*/
       call symput('fdate','"'||put(datec,datetime16.)||'"dt');
run;
*;
%mend;

/** then you only have to call the macro just before your datastep **/

%filedte(yourfile);

/* and now macro var &fdate contains the sas date of creation of your file
   in a datetime format  */

*
;