SAS: generate abstractly long and large dataset
Attempting to perform performance testing I cannot evaluate the macro
%generate(n_rows,n_cols);
which will generate a table with n_rows and n_cols filled with random numbers / strings I tried using this link: http://bi-notes.com/2012/08/benchmark-io-performance/
But I quickly ran into a memory problem
Thank!
+3
source to share
1 answer
Try it. I added 2 input parameters. So now you have some numbers and some symbols. You can also define the name of the output dataset.
%macro generate(n_rows,n_num_cols,n_char_cols,outdata=test,seed=0);
data &outdata;
array nums[&n_num_cols];
array chars[&n_char_cols] $;
temp = "abcdefghijklmnopqrstuvwxyz";
do i=1 to &n_rows;
do j=1 to &n_num_cols;
nums[j] = ranuni(&seed);
end;
do j=1 to &n_char_cols;
chars[j] = substr(temp,ceil(ranuni(&seed)*18),8);
end;
output;
end;
drop i j temp;
run;
%mend;
%generate(10,10,10,outdata=test);
+3
source to share