I am able to copy the files from one folder to another folder: Below is the code with changes: options missing = ' ' xsync noxwait nosymbolgen nomlogic; filename DIRLIST1 pipe 'dir "c:\Test2013\test*.*" '; data dirlist1; infile dirlist1 lrecl=200 truncover; input line $200.; if input(substr(line,1,10), ?? mmddyy10.) = . then delete; length file_name $ 100 ; file_name=scan(line,-1," "); keep file_name; run; filename DIRLIST2 pipe 'dir "c:\Test2014\test*.*" '; data dirlist2; infile dirlist2 lrecl=200 truncover; input line $200.; if input(substr(line,1,10), ?? mmddyy10.) = . then delete; length file_name $ 100 ; file_name=scan(line,-1," "); keep file_name; run; proc sort data = dirlist1; by file_name; run; proc sort data = dirlist2; by file_name; run; data final; merge dirlist1(in=a) dirlist2(in=b); if a and not b; by file_name; run; data final; set final end=eof; count+1; call symput('read1' || strip(put(count,8.)),left(trim(file_name))); if eof then call symputx('max_cnt',count); run; %put &max_cnt.; %macro file_copy; data _null_; %do i=1 %to &max_cnt; x "copy c:\Test2013\&&read1&i c:\Test2014\&&read1&i"; %end; run; %mend; %file_copy;
... View more