Hi Statalist experts,

Suppose I have data on a population of N subjects, each has X1-X5 and and variable p specifying its sampling probability. Each subject has an unequal probability of being selected. Supposed I would like to select a sample of size n taking into account the sampling probability, how would I do that? I am looking for a function that parallels the "sample(x, size, replace = , prob = )" function in R.

Thank you in advance!

Best,

Eva