The SURVEYSELECT Procedure

Example 117.1 Replicated Sampling

(View the complete code for this example.)

This example uses the Customers data set from the section Getting Started: SURVEYSELECT Procedure. The data set Customers contains an Internet service provider’s current subscribers, and the service provider wants to select a sample from this population for a customer satisfaction survey.

This example illustrates replicated sampling, which selects multiple samples from the survey population according to the same design. You can use replicated sampling to provide a simple method of variance estimation, or to evaluate variable nonsampling errors such as interviewer differences. For information about replicated sampling, see Lohr (2010), Wolter (2007), Kish (1965), Kish (1987), and Kalton (1983).

This design includes four replicates, which each have a sample size of 50 customers. The sampling frame is stratified by State and sorted by Type and Usage within strata. Customers are selected by sequential random sampling with equal probability within strata. The following PROC SURVEYSELECT statements select a probability sample of customers from the Customers data set by using this design:

title1 'Customer Satisfaction Survey';
title2 'Replicated Sampling';
proc surveyselect data=Customers method=seq n=(8 12 20 10)
                  reps=4 seed=40070 ranuni out=SampleRep;
   strata State;
   control Type Usage;
run;

The STRATA statement names the stratification variable State. The CONTROL statement names the control variables Type and Usage.

In the PROC SURVEYSELECT statement, the METHOD=SEQ option requests sequential random sampling. The REPS= option specifies 4 replicates of this sample. The N=(8 12 20 10) option specifies the stratum sample sizes in each replicate. The N= option lists the stratum sample sizes in the same order as the strata appear in the Customers data set, which is sorted by State. The sample size of 8 customers corresponds to the first stratum, (State = 'AL'); the sample size of 12 customers corresponds to the second stratum (State = 'FL'), and so on.

The SEED= option specifies 40070 as the initial seed for random number generation. The RANUNI option requests random number generation by the RANUNI generator, which PROC SURVEYSELECT uses in releases before SAS/STAT 12.1. (Beginning in SAS/STAT 12.1, PROC SURVEYSELECT uses the Mersenne twister random number generator by default.) You can specify the RANUNI option along with the same SEED= option value to reproduce a sample that PROC SURVEYSELECT selects in releases before SAS/STAT 12.1. To reproduce a sample by using the RANUNI and SEED= options, you must also specify the same input data set and sample selection parameters.

Output 117.1.1 displays the output from PROC SURVEYSELECT, which summarizes the sample selection. A total of 200 customers is selected in 4 replicates. PROC SURVEYSELECT selects each replicate by using sequential random sampling within strata that are determined by State. The sampling frame Customers is sorted by the control variables Type and Usage within strata, according to hierarchic serpentine sorting. The output data set SampleRep contains the sample.

Output 117.1.1: Sample Selection Summary

Customer Satisfaction Survey
Replicated Sampling

The SURVEYSELECT Procedure

Selection MethodSequential Random Sampling
 With Equal Probability
Strata VariableState
Control VariablesType
 Usage
Control SortingSerpentine

Input Data SetCUSTOMERS
Random Number Seed40070
Number of Strata4
Number of Replicates4
Total Sample Size200
Output Data SetSAMPLEREP


The following PROC PRINT statements display the selected customers for the first stratum (State = 'AL') in the output data set SampleRep:

title1 'Customer Satisfaction Survey';
title2 'Sample Selected by Replicated Design';
title3 '(First Stratum)';
proc print data=SampleRep;
   where State = 'AL';
run;

Output 117.1.2 displays the 32 sample customers in the first stratum (State = 'AL') from the output data set SampleRep, which includes the entire sample of 200 customers. The variable SelectionProb contains the selection probability, and SamplingWeight contains the sampling weight. Because customers are selected with equal probability within strata in this design, all customers in the same stratum have the same selection probability. These selection probabilities and sampling weights apply to a single replicate, and the variable Replicate contains the sample replicate number.

Output 117.1.2: Customer Sample (First Stratum)

Customer Satisfaction Survey
Sample Selected by Replicated Design
(First Stratum)

ObsStateReplicateCustomerIDTypeUsageSelectionProbSamplingWeight
1AL1882-37-7496New572.004115226243
2AL1581-32-5534New863.004115226243
3AL1980-29-2898Old571.004115226243
4AL1172-56-4743Old128.004115226243
5AL1998-55-5227Old35.004115226243
6AL1625-44-3396New60.004115226243
7AL1627-48-2509New114.004115226243
8AL1257-66-6558New172.004115226243
9AL2622-83-1680New22.004115226243
10AL2343-57-1186New53.004115226243
11AL2976-05-3796New110.004115226243
12AL2859-74-0652New303.004115226243
13AL2476-48-1066New839.004115226243
14AL2109-27-8914Old2102.004115226243
15AL2743-25-0298Old376.004115226243
16AL2722-08-2215Old105.004115226243
17AL3668-57-7696New200.004115226243
18AL3300-72-0129New471.004115226243
19AL3073-60-0765New656.004115226243
20AL3526-87-0258Old672.004115226243
21AL3726-61-0387Old150.004115226243
22AL3632-29-9020Old51.004115226243
23AL3417-17-8378New56.004115226243
24AL3091-26-2366New93.004115226243
25AL4336-04-1288New419.004115226243
26AL4827-04-7407New650.004115226243
27AL4317-70-6496Old452.004115226243
28AL4002-38-4582Old206.004115226243
29AL4181-83-3990Old33.004115226243
30AL4675-34-7393New47.004115226243
31AL4228-07-6671New65.004115226243
32AL4298-46-2434New161.004115226243