29 %LOCAL dirfile encoding s l_i_path;
32 create table &o_out (filename
char(255));
35 %IF (not %sysfunc (exist (&o_out))) %THEN %GOTO errexit;
37 %let encoding=pcoem850;
39 %let dirfile=%sysfunc(pathname(work))/&o_out..dir.txt;
40 filename _dirfile
"&dirfile" encoding=&encoding;
42 %put &g_note.(SASUNIT): Directory search is: &i_path;
44 %let l_i_path=%qsysfunc(tranwrd(&i_path, %str( ), %str(\ )));
46 %IF &i_recursive=0 %then
49 %let search = %qscan(&l_i_path.,-1,
'/');
50 %let k = %index(&l_i_path.,%qtrim(&search.));
51 %let path = %qsubstr(&l_i_path.,1,%eval(&k.-2));
52 %
if %qsubstr(&path.,1,1) eq %str(%') %then
53 %let path = &path.%str(%');
54 %if %qsubstr(&path.,1,1) eq %str(%") %then
55 %let path = &path.%str(%");
57 %SYSEXEC(find &path. -name "&search." -ls &s. -type f > &dirfile.);
59 data &o_out (keep=filename changed);
65 format changed datetime20.;
66 infile _dirfile delimiter=
' ' truncover;
67 input dum1-dum7 $ dat1-dat3 $ fileall $;
69 if substr(dum3,1,1)=
'd' then
delete;
70 if index(dat3,
':') gt 0 then do;
71 changed = input(compress(dat2 || dat1 || year(today())) || " " || dat3, datetime.);
72 if changed gt today() then do;
73 changed = input(compress(dat2 || dat1 || year(today())-1) || " " || dat3, datetime.);
77 changed =input(compress( dat2 || dat1 || dat3) || " 00:00", datetime.);