Reading a file 4003 times using the POINT= approach (i.e. direct access to records) is probably a lot slower than finding a way to let SAS use its intrinsically faster sequential access. And if your dataset is large, it's worth finding a faster approach that effectively uses SAS sequential data access engine. Beyond that, using PROC append would be more like a "bulk load" of the data.
Of course you really don't want to run 4003 iterations of PROC APPEND. And you don't have to. This program concatenates the data set to itself, meaning it doubles in size at every iteration. So if you were to ask for N=4096, you'd have 12 iterations. For N=4003, you have 11 iterations and a 12th "partial" iteration, adding a fraction of the data set to itself.
%let nreps=4003;
data _null_;
maxpower=floor(log2(&nreps));
put maxpower=;
call execute('data class;set sashelp.class;run;');
do power=1 to maxpower;
call execute('proc append base=class data=class;run;');
end;
if 0 then set sashelp.class nobs=nrecs;
obs_to_add=nrecs*(&nreps - 2**maxpower);
if obs_to_add>0 then
call execute(cats('proc append base=class data=class (obs=',obs_to_add,');run;'));
run;
... View more