Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SAS: generate abstractly long and large dataset

Trying to do some performance testing I can't figure out a macro

%generate(n_rows,n_cols);

that would 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 encounter a memory issue

Thanks!

like image 715
Stephane Maarek Avatar asked Sep 10 '25 06:09

Stephane Maarek


1 Answers

Try this. I added a 2 input parameters. So now you have a number of numerics and a number of characters. Also the ability to define the output dataset name.

%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);
like image 141
DomPazz Avatar answered Sep 13 '25 03:09

DomPazz