I have more than 200 thousand small data sets with the same variables (n <1000 and usually n <100) that I want to combine into a main data set. I tried using a macro that uses a data step to simply iterate over all new data sets and combine with the wizard using "set master new:", but it takes a lot of time. In addition, if I try to start at the same time, then at the stage of the call, it will be indicated that I lost memory on a huge server. For reference, all small datasets together make up just over 5 gigs. Any suggestions would be appreciated. Here is what I still have:
%macro catDat(name, nbr) ; data new ; set libin.&name ; run ; proc sql noprint; create table new as select var1, var2, var3 from new; quit; %if &nbr = 1 %then %do ; data master; set new; run; %end; %if &nbr > 1 %then %do ; data master; set master new ; run; %end ; %mend; data runthis ; set datasetNames ; call execute('%catdat('||datasetname||','||_n_||')'); run;
Allowed: see Bob's comments below.
source share