Below is the guise of the DATA SET step. I got files in a directory which start with a common prefix.
For the sake of this debugging program, let's say the prefix is 'test'.
So we got files like test_abc.txt, test_123.txt and so on.
What we want to do is to extract the last modified time of each file. Since I am under Unix system, I use the following "foo pipe 'ls -o -g --full-time ...'" to get the time which we are interested in.
In work.tempo, I wish to get a table with a list of filename(vname) and the corresponding modification date (mod_datec).
Voilà le souci, je vous remercie!
%macro universe(directory, countryname, prefix);
data work.tempo;
length vname $256.;
rc = dopen(&directory);
vmax = dnum(rc);
select("&countryname");
when ("France")
do;
do i = 1 to vmax;
vname = dread(rc,i);
if vname=:"&prefix."
then do;
filename foo pipe "ls -g -o --full-time ~/&prefix.*";
data _null_;
infile foo;
input @15 mod_date $11.;
if mod_date=" " then stop;
mod_datec = scan(mod_date,1,"-")
||scan(mod_date,2,"-")
||scan(mod_date,3,"-");
put mod_datec= ;
run;
/*I want to output mod_datec to work.tempo from here*/
end;
end;
end;
otherwise;
end;
rc = dclose(rc);
run;
%mend;
%universe(Earth, France, test);