You can genralize the macro even more by passing the parameters of the RAND function into the macro. Such as:
%macro create_random_sample ( sample_size, distribution_parameters );
* strip the quotes from the distribution name;
%let distribution = %sysfunc( compress( %scan( &distribution_parameters, 1, %str(,) ), %str(%') ));
data &distribution;
do until ( id = &sample_size );
id + 1;
dist_var = rand( &distribution_parameters );
output;
end;
run;
%mend;
%create_random_sample ( 100, %str('normal', 0, 1) );
%create_random_sample ( 100, %str('t', 4) );
%create_random_sample ( 100, 'logn' );
%create_random_sample ( 100, %str('poisson', 6.1) );
%create_random_sample ( 100, %str('binom', .75, 10) );
... View more