I want to create a simulated variable from a normal distribution. I know the mean and the standard deviation of this variable.
I want this variable to be between 1000 and 50000.
how should I do?
i would specify a mean of 25,500 (50000/2 + 1000/2) and a standard deviation big enough to spread the random variates from 1000 to 50000. An SD aroud 8000 will get you in the ballpark, but to my knowledge there's no way to restrict random variates in SAS to a specified range. You can discard the outliers i guess.
Here's one thing you can try....specify a larger standard deviation and discard the outliers. The shaprio-wilkes test for normality has a very high p-value (>.95) indicating perfect normality:
data sim;
do i=1 to 1000;
x = rand('NORMAL', 25500, 10000);
if 1000 <= x <= 50000 then output;
end;
run;
proc univariate data = sim normal plot;
var x;
run;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.