vendredi 10 mars 2017

SAS: Find the seed used to generate random numbers

Is it possible to find the seed SAS used to generate a set of random numbers?

For instance, if I run

data random;
  do i = 1 to 10;
    x = rand('uniform');
    output;
  end;
  drop i;
run;

and SAS produces a sequence of values which I like, can I find what seed generated that particular sequence of values?

Having the seed used for a particular run could be useful, for instance, in jittering data. When I need to jitter data for a plot, I have to manually try different seeds to find one which doesn't have (too many) overlaps. It would be simpler to let SAS pick the seed, run the jittering until the plot looks good, then set the seed to whatever value SAS happened to pick.




Aucun commentaire:

Enregistrer un commentaire