I have generated 100 samples each with 100 random numbers between 0 and 1 using the following code (thnx patrick!):
do sample=1 to 100;
do n=1 to 1000;
For each of these samples I found the mean using proc tabulate. Now, I need to find the (simulated) probability that the mean of a sample is between .49 and .5, inclusive.
Is there a way to get the proc tabulate output into a dataset so I can then use "if" statements to keep all means between .49 and .5, count them and then divide by 100 to get the probability? Or is there a faster way to do this entirely in the data step (ie. using another loop)?
Thanks, your help would be much appreciated!
PROC MEANS, BY SAMPLE with an OUTPUT statement, puts all your means into a dataset. Then, use another data step to count the times the mean is in the desired range, and the number of times it is not in the desired range.