BookmarkSubscribeRSS Feed
Calcite | Level 5

What is the best way to take a sample from a population while controlling its characteristics? Is it possible to take a sample while specifying a min/max/mean/std dev? It's easy enough to filter something down so that you end up with the necessary averages for whatever characteristics you're looking for, but I need the distributions to look a specific way too. Any thoughts on the best way to approach this?

Jade | Level 19

No idea if this will work, or if it even is a legitimate method.

It is much easier to simulate a dataset with the characteristics that you are looking for than it would be to select and hope.  Suppose you had the simulated data in hand, and then did a match against the variable of interest in the target dataset, so that only those values that come from a known distribution would be selected.  Probably would involve some rounding and a merge using in=.  I have never seen this done before, but maybe it would work.

Steve Denham


It is not clear to me whether you are trying to specify the characteristics of the population or of the sample.

In simulation studies, you specify the characteristics of the population. The parameter estimates for any random sample will deviate from those population parameters.

There are many ways to choose the parameters in a distribution to match the desired characteristics. Of course, you need enough parameters to satisfy all of the constraints.  For example, a uniform distribution only has two parameters, so in general you cannot make it match the four constraints.  If you want a parametric distribution with a given min/max/mean/StdDev, I'd use a (scaled) beta distribution or a truncated normal distribution.

You can also choose to solve this problem by using a nonparametric specification of the CDF of the distribution. For a discussion, see Approximating a distribution from published quantiles - The DO Loop  If your distribution is symmetric, then the mean equals the median and you can play with the interquartile range and the shape of the tails to obtain the required StdDev.

Barite | Level 11

I have the same question. I would like to choose a sample (a control group) from a large population based on the parameters of another, defined group from the same population. Any suggestions are welcome.


This does not sound like the same question. Please start a new thread and provide more details about your population and the characteristics that you are hoping to match. 



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 4 in conversation