Hello,
I am using a first linux command to get all the files in the folder /../sasdata/ and recursively and it works fine.
Then I use a command like this one below, to get all possible path where the files is hosted, but when it takes to much time, the response value is not obtained
%macro doit(dir=);
libname dest1 base "/..._Data_Retention/data";
/*proc printto log='/.../Temp/Alain/logfiles/sasfiles_log.txt' new;*/
/*run;*/
filename oscmd1 pipe "ls -Rla --time-style=long-iso ~ &dir. | awk '{printf ""%-10s %-10s %10s %20s %12s %s %s\n"", $1, $3, $4, $5, $6, $7, substr($0,index($0,""/""),500)}'";
Data dest1.sasfiles1 ;
format fname $50. ;
infile oscmd1 dsd LRECL=32000 TRUNCOVER firstobs=2;
input
permissions $ 1-12
owner $ 12-24
group $ 26-35
fsize $ 36-54
cr_dt $ 55-67
time $ 68-74
filepath $ 75-500
;
run;
data sasfiles2;
format create_date create_date2 yymmdd10. create_time tod5.;
length cfname $100. fname $50.;
set dest1.sasfiles1;
where owner eq 'dwhprd1' and find(filepath,'prm')> 0 and find(filepath, '_ab_') =0 and find(filepath, 'raw') =0 and find(filepath, '_d') =0 and find(filepath, 'dat') =0
and find(filepath,'test')= 0 and find(filepath,'after')= 0 and find(filepath,'Test')= 0 and find(filepath,'zip')= 0 and find(filepath,'prmccl') = 0
and find(filepath,'tst001mc')= 0 and find(filepath,'prmmichele')= 0 and find(filepath,'_old')= 0 and find(filepath,'gcna_prm_src')= 0
and find(filepath,'histo')= 0 and find(filepath,'all')= 0 and find(filepath,'atl')= 0 and find(filepath,'before')= 0 and find(filepath,'war')= 0
and find(filepath,'log')= 0 and find(filepath,'lst')= 0 and find(filepath,'cmay25p')= 0 and find(filepath,'conprjc')= 0 and find(filepath,'conprjh')= 0
and find(filepath,'pasprjc')= 0 and find(filepath,'cyc1')= 0 and find(filepath,'eco')= 0 and find(filepath,'igroup')= 0 and find(filepath,'ont_ont')= 0
and find(filepath,'pas')= 0 and find(filepath,'prji')= 0 and find(filepath,'uapr')= 0 and find(filepath,'wst')= 0 and find(filepath,'ukp')= 0
and find(filepath,'dev')= 0 and find(filepath,'ykp')= 0 and find(filepath,'cmcle')= 0 and find(filepath,'nhfld')= 0 and find(filepath,'bad')= 0
and find(filepath,'abw2')= 0 and find(filepath,'bcclm')= 0 and find(filepath,'covid')= 0 and find(filepath,'prj')= 0 and find(filepath,'west')= 0
and find(filepath,'tsv')= 0 and find(filepath,'octv')= 0 and find(filepath,'wcauto')= 0 and find(filepath,'sept2017')= 0 and find(filepath,'novtst2017')= 0 ;
filesize=input(fsize,8.);
fname = scan(scan(filepath,-1,''),1,'.');
cfname=scan(filepath,-1,'');
create_date=input(cr_dt,yymmdd10.);
create_date2=intnx('day',create_date,1);
create_time=input(time,time.);
cr_dt2=put(create_date2,yymmdd10.);
run;
proc sql;
create table sasfile as
select owner,
group,
permissions,
cfname,
fname,
cr_dt,
cr_dt2,
create_date,
create_date2,
create_time,
sum(filesize) format = SIZEKMG6.2 as totalfsize
from sasfiles2
group by fname;
quit;
data sasfile;
rownum = _n_;
set sasfile /*(firstobs=1 obs=2)*/;
run;
data want ;
length fvar $1000;
set sasfile;
fvar = cat("find /dwh_actuariat/sasdata/ -iname ",' "',strip(cfname),'"'," -newermt ",strip(cr_dt)," ! "," -newermt ",strip(cr_dt2), " 2>/dev/null");
run;
/****** Capturing the linux output to a sas data set *****/
data sasfiles;
set want;
infile dummy pipe filevar=fvar dsd LRECL=32000 TRUNCOVER end=done;
do until (done);
input response $400.;
output;
end;
run;
%exit: %mend doit;
%doit(dir=/.../sasdata/);
Pipe command="find /dwh_actuariat/sasdata/ -iname "be_auto_prmaou2013.dpf.00010a49.0.1.spds9" -newermt 2016-07-19 ! -newermt 2016-07-20 2>/dev/null"
NOTE: 1 record was read from the infile DUMMY. The minimum record length was 80. 21 The SAS System 20:38 Wednesday, October 30, 2024
The maximum record length was 80. NOTE: 1 record was read from the infile DUMMY. The minimum record length was 89. The maximum record length was 89. NOTE: 1 record was read from the infile DUMMY. The minimum record length was 80. The maximum record length was 80.
How can we solve that issue ?
... View more