The SURVEYMEANS Procedure

Output Data Sets

You can use the Output Delivery System to create a SAS data set from any piece of PROC SURVEYMEANS output. See the section ODS Table Names for more information.

PROC SURVEYMEANS also provides an output data set that stores the replicate weights for BRR or jackknife variance estimation and an output data set that stores the jackknife coefficients for jackknife variance estimation.

Replicate Weights Output Data Set

If you specify the OUTWEIGHTS= method-option for VARMETHOD=BRR or VARMETHOD=JACKKNIFE , PROC SURVEYMEANS stores the replicate weights in an output data set. The OUTWEIGHTS= output data set contains all observations from the DATA= input data set that are valid (used in the analysis). (A valid observation is an observation that has a positive value of the WEIGHT variable. Valid observations must also have nonmissing values of the STRATA and CLUSTER variables, unless you specify the MISSING option. See the section Data and Sample Design Summary for details about valid observations.)

The OUTWEIGHTS= data set contains the following variables:

  • all variables in the DATA= input data set

  • RepWt_1, RepWt_2, $\ldots $, RepWt_n, which are the replicate weight variables

where n is the total number of replicates in the analysis. Each replicate weight variable contains the replicate weights for the corresponding replicate. Replicate weights equal zero for those observations not included in the replicate.

After the procedure creates replicate weights for a particular input data set and survey design, you can use the OUTWEIGHTS= method-option to store these replicate weights and then use them again in subsequent analyses, either in PROC SURVEYMEANS or in the other survey procedures. You can use the REPWEIGHTS statement to provide replicate weights for the procedure.

Jackknife Coefficients Output Data Set

If you specify the OUTJKCOEFS= method-option for VARMETHOD=JACKKNIFE , PROC SURVEYMEANS stores the jackknife coefficients in an output data set. The OUTJKCOEFS= output data set contains one observation for each replicate. The OUTJKCOEFS= data set contains the following variables:

  • Replicate, which is the replicate number for the jackknife coefficient

  • JKCoefficient, which is the jackknife coefficient

  • DonorStratum, which is the stratum of the PSU that was deleted to construct the replicate, if you specify a STRATA statement

After the procedure creates jackknife coefficients for a particular input data set and survey design, you can use the OUTJKCOEFS= method-option to store these coefficients and then use them again in subsequent analyses, either in PROC SURVEYMEANS or in the other survey procedures. You can use the JKCOEFS= option in the REPWEIGHTS statement to provide jackknife coefficients for the procedure.

Poststratification Weights Output Data Set

If you specify the OUTPSWGT= option in the POSTSTRATA statement, PROC SURVEYMEANS stores the poststratification weights in an output data set. The OUTPSWGT= output data set contains all observations from the DATA= input data set that are valid (used in the analysis). (A valid observation is an observation that has a positive value of the WEIGHT variable. Valid observations must also have nonmissing values of the STRATA and CLUSTER variables, unless you specify the MISSING option. See the section Data and Sample Design Summary for more information about valid observations.)

For VARMETHOD=TAYLOR , the OUTPSWGT= data set contains the following variables:

  • all variables in the DATA= input data set

  • _PSWt_, which contains poststratification weights

For VARMETHOD=BRR and VARMETHOD=JACKKNIFE , the OUTPSWGT= option is the same OUTWEIGHTS= method-option that you specify in the PROC SURVEYMEANS statement , except that it also contains the variable _PSWt_, which contains poststratification weights for the full sample. The replication weights, adjusted for poststratification, are stored in the OUTWEIGHTS= data set. See the section Replicate Weights Output Data Set for the contents of the OUTWEIGHTS= data set.

However, if you also specify an OUTWEIGHTS= method-option in the PROC SURVEYMEANS statement and use a different data set name, the data set in OUTPSWGT= option is ignored.

If you provide your own replicate weights by using a REPWEIGHTS statement for VARMETHOD=BRR or VARMETHOD=JACKKNIFE , the poststratification replicate weights replace the original replicate weights in the OUTPSWGT= data set.

Rectangular and Stacking Structures in an Output Data Set

When you use an ODS output statement to create SAS data sets for certain tables in PROC SURVEYMEANS, there are two possible types of table structure for the output data sets: rectangular and stacking. A rectangular structure creates one observation for each analysis variable in the data set. A stacking structure creates only one observation in the output data set for all analysis variables.

Before SAS 9, the stacking table structure, similar to the table structure in PROC MEANS, was the default in PROC SURVEYMEANS. Since SAS 9, the new default is to produce a rectangular table in the output data sets. You can use the STACKING option to request that the procedure produce the output data sets by using a stacking table structure.

The STACKING option affects the following tables:

  • Domain

  • Ratio

  • Statistics

  • StrataInfo

Figure 112.7 and Figure 112.8 shows these two structures for analyzing the following data set:

data new; 
   input sex$ x; 
   datalines; 
M 12
F 5
M 13
F 23
F 11
;

The following statements request the default rectangular structure of the output data set for the statistics table:


proc surveymeans data=new mean;
   ods output statistics=rectangle;
run;

proc print data=rectangle;
run;

Figure 112.7 shows the rectangular structure.

Figure 112.7: Rectangular Structure in the Output Data Set

Rectangular Structure in the Output Data Set

Obs VarName VarLevel Mean StdErr
1 x   12.800000 2.905168
2 sex F 0.600000 0.244949
3 sex M 0.400000 0.244949



The following statements specify the STACKING option to request that the output data set have a stacking structure:


proc surveymeans data=new mean stacking;
   ods output statistics=stacking;
run;

proc print data=stacking;
run;

Figure 112.8 shows the stacking structure of the output data set for the statistics table requested by the STACKING option.

Figure 112.8: Stacking Structure in the Output Data Set Requested by the STACKING option

Stacking Structure in the Output Data Set

Obs x x_Mean x_StdErr sex_F sex_F_Mean sex_F_StdErr sex_M sex_M_Mean sex_M_StdErr
1 x 12.800000 2.905168 sex=F 0.600000 0.244949 sex=M 0.400000 0.244949