K Tom my be i didn't represent very well... forget about that - forget about control table and all Here is the real coding options mprint mlogic symbolgen; %let ext=txt; %let dir1=w:\data\in\; %let dir2=w:\shares\woo\; data f_list1; length fname1 $200; infile "dir &dir1.*.&ext /tw " pipe truncover lrecl=3000 ; input fname1 $200.; run; data f_list2; length fname2 $200; infile "dir &dir2.*.&ext /tw " pipe truncover lrecl=3000 ; input fname2 $200.; run; data a; format upload_date date.; set f_list1; if find(upcase(fname1),upcase("k_first_file"))>0; r_name=substr(upcase(fname1),find(upcase(fname1),upcase("k_first_file"))); upload_date=input(substr(fname1,1,10),mmddyy10.); run; proc sort data=a; by descending upload_date; run; data a ; set a(obs=1); call symput("upload_1",put(upload_date, date9.)); run; data b; format upload_date date.; set f_list2; if find(upcase(fname2),upcase("k_second_file"))>0; r_name=substr(upcase(fname2),find(upcase(fname2),upcase("k_second_file"))); upload_date=input(substr(fname2,1,10),mmddyy10.); run; proc sort data=b; by descending upload_date; run; data b; set b(obs=1); call symput("upload_2",put(upload_date, date9.)); run; data c; format upload_date date.; set f_list1; if find(upcase(fname1),upcase("K_third_file"))>0; f_name=substr(upcase(fname1),find(upcase(fname1),upcase("K_third_file"))); r_name=(substr(fname1,40,150)); /*pulling full name for file "K_third_file" to use it later in filename statement*/ r_name=trim(left(r_name)); upload_date=input(substr(fname1,1,10),mmddyy10.); run; proc sort data=c; by descending upload_date; run; data c; set c (obs=1); call symput("upload_3",put(upload_date, date9.)); call symput("r_name",r_name); run; /*Read "K_third_file" file in and figure how many distinct date there in file*/ filename xyzin "&dir1.&r_name."; data file_in_1; infile xyzin dsd delimiter='|' firstobs=2; length date $ 20 x $ 10 y $ 10 z $ 10 input date $ x $ y $ z$ ; run; proc sql; create table dist_date_c as select distinct date from file_in_1; quit; /*i stuck from here*/ /*here lets say table "c_uni_date" has 3 distinct date which is not a case all time - could be 1 distinct date or 2 or 3*/ /*so need to create macro variable for all 3 dates (if 3 distinct date) and need to show in email...*/ /*not sure but we can do this - we can create one new macro variable X here which include n number of date macro variable (3 in this case) so that we can mentioned &x in message to show 3 different macro variable which would resolve in 3 dif. date...like "&&x&daten"=date1 date2 date3*/ data d; format upload_date date.; set f_list1; if find(upcase(fname1),upcase("k_forth_file"))>0; f_name=substr(upcase(fname1),find(upcase(fname1),upcase("k_forth_file"))); m_name=(substr(fname1,40,150)); /*pulling full name for file "K_forth_file" to use it later in filename statement*/ m_name=trim(left(m_name)); upload_date=input(substr(fname1,1,10),mmddyy10.); run; proc sort data=d; by descending upload_date; run; data d; set d(obs=1); call symput("upload_4",put(upload_date, date9.)); call symput("m_name",m_name); run; filename abcin "&dir2.&m_name."; data file_in_2; infile abcin dsd delimiter='|' firstobs=2; length date $ 20 a $ 10 b $ 10 c $ 10 input date $ a $ b $ c $ ; run; proc sql; create table uni_date_d as select distinct date from file_in_2; quit; /*here lets say table "c_uni_date" has 3 distinct date which is not a case all time - could be 1 distinct date or 2 or 3*/ /*same thing here - we can create one new macro variable X here which include n number of date macro variable (3 in this case) so that we can mentioned &x in message to show 3 different macro variable which would resolve in 3 dif. date...like "&&x&daten"=date1 date2 date3*/ %let file1=k_first_file; %let file2=k_second_file; %let file3=k_third_file; %let file4=k_forth_file; filename mymail email subject="All file detail" to= ("xyz@yahoo.com"); data _null_; set a; set b; set c; set d; file mymail; put "&file1 uploaded on &upload_1"; put " "; put "&file2 uploaded on &upload_2"; put " "; put "&file3 uploaded on &upload_3 with distinct date: /*numbers of distinct date goes here - may be 1 or 2 or 3*/"; put " "; put "&file4 uploaded on &upload_4 with distinct date: /*numbers of distinct date goes here - may be 1 or 2 or 3*/"; run;
... View more