Say I want to select a random sample of 5 car makes (out of the total of 38 different makes) from sashelp.cars and pull all records sharing one of the randomly select 5 car makes.
I've tried the following but it returns an error message.
How do you perform random sampling of records by variable value?
proc sort data=sashelp.cars; by make; run;
proc surveyselect data=sashelp.cars
out=work.cars_samp
seed=123
method=srs
n=5;
strata make;
run;
ERROR: The sample size, 5, is greater than the number of sampling units, 1.
NOTE: The above message was for the following stratum:
Make=Hummer.
ERROR: The sample size, 5, is greater than the number of sampling units, 2.
NOTE: The above message was for the following stratum:
Make=Isuzu.
ERROR: The sample size, 5, is greater than the number of sampling units, 3.
NOTE: The above message was for the following stratum:
Make=Jeep.
ERROR: The sample size, 5, is greater than the number of sampling units, 3.
NOTE: The above message was for the following stratum:
Make=Land Rover.
ERROR: The sample size, 5, is greater than the number of sampling units, 2.
NOTE: The above message was for the following stratum:
Make=MINI.
ERROR: The sample size, 5, is greater than the number of sampling units, 3.
NOTE: The above message was for the following stratum:
Make=Oldsmobile.
ERROR: The sample size, 5, is greater than the number of sampling units, 2.
NOTE: The above message was for the following stratum:
Make=Scion.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.CARS_SAMP may be incomplete. When this step was stopped there were 155 observations and 17 variables.
WARNING: Data set WORK.CARS_SAMP was not replaced because this step was stopped.
... View more