It looks like you will be starting the process with a macro call to '%ods_creation' macro: %ods_creation; It will create driver tables for later steps. Then, it will call '%sub_ods_process' macro. We are still in the same session. Inside this macro SAS is starting up child sessions and when &i= &order_key waiting for all child sessions to finish or time out 2500 sec. How many child sessions are there running when &i = &order_key (1, 2, ...)? SYSTASK COMMAND will start each child SAS session with NOWAIT option in effect by default. Can you run the following macros and post the log to see how &i and &order_key values change? Need to see how many &i values there have been when &i = &order_key since it is the criteria to wait for all child sessions to finish or time out. %macro sub_ods_process_test; %let loop=1; %put order = &order nobs = &nobs; %do i = 1 %to &nobs; %let files_names=%scan(&file_name,&i); %let order_key=%scan(&order,&i); %put i=&i order_key=&order_key; %if &i= &order_key %then %do; %let loop=%eval(&order_key +1); %end; %end; %mend; %macro ods_creation_test; %global file_name; %global nobs; /* Sorting the Audit tables and creating temp dataset having file_name which are success */ proc sort data=&mac.stg_load_audit (where=( main_job_id=input(strip(resolve('&mac_main_job_id')),8.) and job_status=1)) out=stg_load_audit(keep= file_surrogate_key file_name); by file_surrogate_key; run; /* Sorting the mst file and creating temp dataset */ proc sort data=&mac.mst_file (keep=file_surrogate_key file_load_order) out=mst_file_metadata; by file_surrogate_key; run; /* Merge above temp tables and get the file_load_order for each of the successed AP04 files */ data audit_order; merge stg_load_audit(in=a) mst_file_metadata(in=b); by file_surrogate_key; if a; run; proc sort data=audit_order; by file_load_order; run; /* Counting Number of Records present in AP04*/ data _null_; dsid=(open("work.audit_order","in")); nobs=(attrn(dsid,"nobs")); call symputx('nobs',nobs); rc=close(dsid); run; /* Creating Macro variable for each file_name */ proc sql noprint; Select file_name, count(file_load_order) + min(monotonic())-1 into: file_name separated by ' ', : order separated by ' ' from audit_order group by file_load_order; quit; %sub_ods_process_test; /* Deleting temp datasets */ proc datasets library=work kill nolist; quit; %mend; %ods_creation_test;
... View more