/* This program simulates rolling a fair die 1000 times. */ /* To generate more random values, increase the number in the do loop. */ data uni; n+1; do i = 1 to 1000; X = int(1 + 6*ranuni(0)); output; end; /* Note: The int( ) function in SAS truncates a value at the integer. */ proc print data=uni; var X; run; /* Plot a picture of the random numbers generated. */ proc chart data=uni; vbar X / midpoints = 1 2 3 4 5 6; run; /* Simulate heights of men from a Normal distribution with */ /* mean 65 and standard deviation 3. */ data nor; n+1; do i = 1 to 100; Y = 65 + 3*rannor(0); output; end; proc print data=nor; var Y; run; /* Plot a picture of the random numbers generated. */ proc chart data=nor; vbar Y; run;