Hi My problem is as below. There is a general sas program which calls many macro in order using call execute. I have to replace one of that macro so that parallel processing can be introduced. Now the problem is since my macro will be called using call execute the sas codes get executed in the last where as the macro will be executed first. please let me know hw to overcum this: my code is below: %macro kill_job; /* Macro call to kill job which got failed;*/ systask kill &kill; %mend; %macro sub_ods_process; %let loop=1; %do i = 1 %to &nobs; %let files_names=%scan(&file_name,&i); %let order_key=%scan(&order,&i); %global &files_names&i._status; %global &files_names&i._name; systask command "%SYSGET(SASEXE) /* this is a environmental variable defined */ -noterminal -logparm 'rollover=session' -sysin d:\temp\trial.sas -log d:\temp\&files_names._#y.#m.#d_#h.#m.#s.log -sysparm &files_names." taskname= "&files_names&i._name" status="&files_names&i._status"; %if &i= &order_key %then %do; /* Wait for the task to complete for 15 mins */ WAITFOR _ALL_ %do j= &loop %to &order_key; %scan(&file_name,&j)&j._name %str( ) %end; timeout=2500; %if &sysrc ne 0 %then %do; /* task timed out */ %put batch sas step timed out; proc sql noprint; select tranwrd(name,"_STATUS","_NAME") into: kill separated by ' ' from sashelp.vmacro where scope ='GLOBAL' and name like upcase('%_status') and value ne '0' and input(substr(reverse(scan(name,1,'_')),1,1),8.) between &loop. and &order_key.; quit; data _null_; call execute(‘%kill_job’); run; %end; %let loop=%eval(&order_key +1); %end; /* End of Batch */ %end; %mend; %macro ods_creation; %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; data _null_; call execute('%sub_ods_process'); run; /* Deleting temp datasets */ proc datasets library=work kill nolist; quit; %mend;
... View more