Hello,
I did some test with sashelp.class and you inlist and inbase statement and it seems to do what I am expecting to get.
Regards,
data test1;
rownumber=_N_;
set sashelp.class;
run;
/* Creating the synthetic masterlist using test1 and applying the following criteria (content of test1 minus people who's age eq 12 years old */
data masterlist;
set test1;
where age ne 12;
run;
data test2_org;
set test1;
where sex eq 'M';
run;
/*data test2 test2_dr;*/
/* merge test2_org (in=inbase)*/
/* masterlist (in=inlist)*/
/* ;*/
/* by rownumber;*/
/* if inlist and inbase then output test2_dr;*/
/* else if inbase then output test2;*/
/*run;*/
/* so as my master list contains many policies per filename, the idea is to create a subdataset just with the filename and path. The make a call execute with the
path and filename then execute the last sas code */
data pathNfilename;
input libname1 :$10. libname2 :$10. fname :$10.;
datalines;
source1 dest1 test2
;
run;
data _null_;
set pathNfilename;
call execute
(compbl(cat(
'%nrstr(libname ',strip(libname1),' "%sysfunc(pathname(work))"; )',
'%nrstr(libname ',strip(libname2),' "%sysfunc(pathname(work))"; )',
"data ",strip(fname)," ",strip(fname),"_dr;",
"merge ",strip(fname),"_org (in=inbase) ","masterlist (in=inlist);",
"by rownumber;",
"if inlist and inbase then output ",strip(fname),"_dr;",
"else if inbase then output ",strip(fname),";run;"
)));
run;
... View more