Saturday, May 21, 2011

Simulate a Normal Distribution


SAS offers a function called rannor which allows you to generate a sample from a normal distribution easily.

data temp(keep=x);
  retain mu 50 std 20 seed 0;
  do i=1 to 1000;
    x = mu + std*rannor(seed);
    output;
  end;
run;

proc chart data=temp;
  vbar x;
run;