Thank you very much Ahmed! I spent some time on SAS and write a integration sas script. Can you help me to take a look? I think I may have errors in the folder recursive searching for the subfolders and files. Thank you very much for your help! Davy intervalForFileValidation = 1; /*** in hours ***/ currentDate = Today(); currentYear = Year(currentDate); currentYearIn2Digits = substr(currentYear,3,2); endyearIn2Digits = currentYearIn2Digits + 1; currentSubmissionPeriod = "" + currentYearIn2Digits + "" + endyearIn2Digits; /** root for project: c:\SAS\data\users\DDM\OCCI\OCCI_AuditYYYY ****/ constantPath = "c:\SAS\data\users\DDM\OCCI\OCCI_Audit"; %Let mypath = cats(of constantPath currentSubmissionPeriod); rawDataFilePath = &mypath.\Data\Rawdata data rawDataDir; length filename dir fullpath $256; dir = "&dataFilePath"; rc = filename("readdir","&rawDataFilePath"); did = dopen("readdir"); memcount = dnum(did); /***** 1. Scan the given file system of rawDataFilePath folder, subfolder and files **************************************************/ do i = 1 to memcount; filename = dread(did,i); fullpath = trim(dir) !! "\" !! filename; fid=fopen("readdir"); fileCreateDate=finfo(fid,"Create Time"); close=fclose(fid); timePassed = (Today() - fileCreateDate)/InHours(); /***** 2. If the file is a TXT one and if it has not been validated before (file create date < 1 hour), populate it *********/ do while(timePassed > intervalForFileValidation and index(filename,"TXT") > 1); if(index(filename,"AIP") > 1) then %Let mvType = AIP; if(index(filename,"AMB") > 1) then %Let mvType = AMB; if(index(filename,"AMH") > 1) then %Let mvType = AMH; if(index(filename,"CCC") > 1) then %Let mvType = CCC; if(index(filename,"RHB") > 1) then %Let mvType = RHB; if(index(filename,"CAC") > 1) then %Let mvType = CAC; %Let mvMileStone= YE; %LET OCDM = Yes; %Let filename = &fullpath; %Let root = &mypath; %INCLUDE "&root.\Program\Shared\Initiate.sas"; ODS path RESET; %INCLUDE "&publicpath\Import.sas"; %INCLUDE "&publicpath\Match.sas"; %INCLUDE "&publicpath\Audit.sas"; %INCLUDE "&publicpath\Export.sas"; OPTIONS MPrint NoSymbolGen NoXWait NoxSync; %GetSettings(0); %GoAuditing(); ODS path RESET; LibName metdata Clear; LibName appdata Clear; LibName result Clear; LibName keydata Clear; end; end; run; rc=dclose(did); drop rc fid did memcount i; run;
... View more