Previous Page | Next Page

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=100 option specifies a sample size of 100 customers. The OUT= option stores the sample in the SAS data set named SampleSRS.

Figure 89.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 equals 0.007423, which is the sample size (100) divided by the population size (13,471). The sampling weight equals 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 89.2 Sample Selection Summary
Customer Satisfaction Survey
Simple Random Sampling

The SURVEYSELECT Procedure

Selection Method Simple Random Sampling

Input Data Set CUSTOMERS
Random Number Seed 39647
Sample Size 100
Selection Probability 0.007423
Sampling Weight 134.71
Output Data Set SAMPLESRS

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 89.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 89.3 Customer Sample (First 20 Observations)
Customer Satisfaction Survey
Sample of 100 Customers, Selected by SRS
(First 20 Observations)

Obs CustomerID State Type Usage
1 036-89-0212 FL New 74
2 045-53-3676 AL New 411
3 050-99-2380 GA Old 167
4 066-93-5368 AL Old 1232
5 082-99-9234 FL New 90
6 097-17-4766 FL Old 131
7 110-73-1051 FL Old 102
8 111-91-6424 GA New 247
9 127-39-4594 GA New 61
10 162-50-3866 FL New 100
11 162-56-1370 FL New 224
12 167-21-6808 SC New 60
13 168-02-5189 AL Old 7553
14 174-07-8711 FL New 284
15 187-03-7510 SC New 21
16 190-78-5019 GA New 185
17 200-75-0054 GA New 224
18 201-14-1003 GA Old 3437
19 207-15-7701 GA Old 24
20 211-14-1373 AL Old 88

Previous Page | Next Page | Top of Page