While I agree entirely with @RW9's observation that your strategy is likely to make your project more inefficient, there is still a diagnosis to be made on the symptom you report. Without seeing the macro code, I suspect that the SIZE parameter in macroA has to be less than 1000 for the last iteration of the loop whenever dataset TABLE1 does not have NOBS in the exact 1,000's. If so, you can do this:
data _null_;
set TABLE1 nobs=nobs ;
file code ;
nloops=int(nobs/1000);
do part=0 to nloops;
if part=nloops then size=mod(nobs,1000);
else size=1000;
put '%macroA(inputtable=TABLE1, outputtable = TABLE2, size=' size ',part=' part')' ;
put '%union(inputtable = TABLE2, part = ' part')' ;
end;
stop;
run;
%include code / source2 ;
You can test this on a dataset with, say, 1011 observations. No need to wait for 442 iterations.
... View more