The SURVEYSELECT Procedure

Simple Random Sampling

The following PROC SURVEYSELECT statements select a probability sample of customers from the Customers data set by using simple random sampling:

title1 'Customer Satisfaction Survey';
title2 'Simple Random Sampling';
proc surveyselect data=Customers method=srs n=100
                  out=SampleSRS;
run;

The PROC SURVEYSELECT statement invokes the procedure. The DATA= option names the SAS data set Customers as the input data set from which to select the sample. The METHOD=SRS option specifies simple random sampling as the sample selection method. In simple random sampling, each unit has an equal probability of selection, and sampling is without replacement. Without-replacement sampling means that a unit cannot be selected more than once. The N= option specifies a sample size of 100 customers. The OUT= option stores the sample in the SAS data set named SampleSRS.

Figure 117.2 displays the output from PROC SURVEYSELECT, which summarizes the sample selection. A sample of 100 customers is selected from the data set Customers by simple random sampling. With simple random sampling and no stratification in the sample design, the selection probability is the same for all units in the sample. In this sample, the selection probability for each customer is 0.007423, which is the sample size (100) divided by the population size (13,471). The sampling weight is 134.71 for each customer in the sample, where the weight is the inverse of the selection probability. If you specify the STATS option, PROC SURVEYSELECT includes the selection probabilities and sampling weights in the output data set. (This information is always included in the output data set for more complex designs.)

The random number seed is 39647. PROC SURVEYSELECT uses this number as the initial seed for random number generation. Because the SEED= option is not specified in the PROC SURVEYSELECT statement, the seed value is obtained by using the time of day from the computer’s clock. You can specify SEED=39647 to reproduce this sample.

Figure 117.2: Sample Selection Summary

Customer Satisfaction Survey
Simple Random Sampling

The SURVEYSELECT Procedure

Selection MethodSimple Random Sampling

Input Data SetCUSTOMERS
Random Number Seed39647
Sample Size100
Selection Probability0.007423
Sampling Weight134.71
Output Data SetSAMPLESRS


The sample of 100 customers is stored in the SAS data set SampleSRS. PROC SURVEYSELECT does not display this output data set. The following PROC PRINT statements display the first 20 observations of SampleSRS:

title1 'Customer Satisfaction Survey';
title2 'Sample of 100 Customers, Selected by SRS';
title3 '(First 20 Observations)';
proc print data=SampleSRS(obs=20);
run;

Figure 117.3 displays the first 20 observations of the output data set SampleSRS, which contains the sample of customers. This data set includes all the variables from the DATA= input data set Customers. If you do not want to include all variables, you can use the ID statement to specify which variables to copy from the input data set to the output (sample) data set.

Figure 117.3: Customer Sample (First 20 Observations)

Customer Satisfaction Survey
Sample of 100 Customers, Selected by SRS
(First 20 Observations)

ObsCustomerIDStateTypeUsage
1017-27-4096GANew168
2026-37-3895ALNew59
3038-54-9276GANew785
4046-40-3131FLNew60
5070-37-6924GANew524
6100-58-3342FLNew302
7107-61-9029ALNew235
8110-95-0432FLNew12
9112-81-9251SCNew347
10137-33-0478GANew551
11143-83-4677ALNew203
12147-19-9164GANew172
13159-51-0606FLNew102
14164-14-7799GAOld388
15165-05-7323SCNew606
16174-69-3566ALOld111
17177-69-6934FLNew202
18181-58-3508ALOld261
19207-41-8446ALOld183
20207-64-7308GANew193