Random Sampling

#1
I have a dataset of 1000 with the following variables: subjno, hospnm, and bthwt. I need to complete the object below.
Objective:
• Convert the Excel spreadsheet into a SAS dataset (permanent or temporary)

• Write a program to randomly select 3 VLBW, 10 LBW, and 25 normal infants from each of the 5 hospitals

• If, in any hospital, there are fewer than 3 VLBW infants then select all of them.

• If, in any hospital, there are fewer than 10 LBW infants then select all of them.

• If, in any hospital, there are fewer than 25 normal infants then select all of them.
 

hlsmith

Omega Contributor
#2
You could write a bunch of procedures using surveyselect without replacement and merge them together. I believe Rick Wicklin may have a blog post on using surveyselect with multilevel data. I am away from a computer, so pretty useless. I would be interested in seeing what you come up with, but likely you will need to use a data step to create the nominal at variable first.