Tom:
your equation was very close, but I had to adjust the logic since, when file_number is 1, your equation resolved to zero.
This is what worked. I created counters for the start, but also the end number, as otherwise if the last dataset had 1 obs, but the file size was set to 10,000, then it ran an additional 9,999 iterations.
Its not the prettiest, but it works. If anybody has improvements to this working solution, I welcome the insight. Thanks
%macro test;
proc sql noprint;
select count(*) into :n
from testcomb&padded_number
;
quit;
%let start_number=%eval(((&padded_number*&file_size)-&file_size)+1);
%let end_number=%eval(&start_number+&n);
%do i=&start_number %to &end_number;
data _null_;
set testcomb&padded_number;
where list_number = &i ;
call symputx('changelist',combos2);
run;
%US13;
%end;
%mend;
%macro join;
proc sql noprint;
select count(*) into :n
from &test_file
;
quit;
data _null_;
set &test_file nobs=_nobs;
call symputx('nrecs', _nobs);
n_files=ceil(_nobs/&file_size);
call symputx('nfiles', n_files);
stop;
run;
%let num_files = &nfiles;
%do z=1 %to &num_files;
%let padded_number = %sysfunc(putn(&z, 4.0));
%test
%end;
%mend join;
%join
... View more