The SURVEYMEANS Procedure 
PROC SURVEYMEANS Statement 
The PROC SURVEYMEANS statement invokes the procedure. In this statement, you identify the data set to be analyzed, specify the variance estimation method, and provide sample design information. The DATA= option names the input data set to be analyzed. The VARMETHOD= option specifies the variance estimation method, which is the Taylor series method by default. For Taylor series variance estimation, you can include a finite population correction factor in the analysis by providing either the sampling rate or population total with the RATE= or TOTAL= option. If your design is stratified, with different sampling rates or totals for different strata, then you can input these stratum rates or totals in a SAS data set that contains the stratification variables.
In the PROC SURVEYMEANS statement, you also can use statistickeywords to specify statistics for the procedure to compute. Available statistics include the population mean and population total, together with their variance estimates and confidence limits. You can also request data set summary information and sample design information.
You can specify the following options in the PROC SURVEYMEANS statement.
sets the confidence level for confidence limits. The value of the ALPHA= option must be between 0 and 1, and the default value is 0.05. A confidence level of produces % confidence limits. The default of ALPHA=0.05 produces 95% confidence limits.
specifies the SAS data set to be analyzed by PROC SURVEYMEANS. If you omit the DATA= option, the procedure uses the most recently created SAS data set.
treats missing values as a valid (nonmissing) category for all categorical variables, which include CLASS, STRATA, CLUSTER, and DOMAIN variables.
By default, if you do not specify the MISSING option, an observation is excluded from the analysis if it has a missing value. For more information, see the section Missing Values.
requests that the procedure treat missing values in the variance computation as not missing completely at random (NOMCAR) for Taylor series variance estimation. When you specify the NOMCAR option, PROC SURVEYMEANS computes variance estimates by analyzing the nonmissing values as a domain or subpopulation, where the entire population includes both nonmissing and missing domains. See the section Missing Values for more details.
By default, PROC SURVEYMEANS completely excludes an observation from analysis if that observation has a missing value, unless you specify the MISSING option. Note that the NOMCAR option has no effect on a categorical variable when you specify the MISSING option, which treats missing values as a valid nonmissing level.
The NOMCAR option applies only to Taylor series variance estimation. The replication methods, which you request with the VARMETHOD=BRR and VARMETHOD=JACKKNIFE options, do not use the NOMCAR option.
requests nonsymmetric confidence limits for the quantiles when you request quantiles with PERCENTILE= or QUANTILE= option. See the section Confidence Limits for more details.
suppresses the display of analysis variables with zero frequency in the output. By default, the procedure displays all continuous variable and all levels of categorical variables.
specifies the order in which the values of the categorical variables are to be reported. The following shows how PROC SURVEYMEANS interprets values of the ORDER= option:
orders values according to their order in the input data set.
orders values by their formatted values. This order is operating environment dependent. By default, the order is ascending.
order values by descending frequency count; the most observed value comes first in the order.
orders values by their unformatted values, which yields the same order that the SORT procedure does. This order is operating environment dependent.
By default, ORDER=FORMATTED.
The ORDER= option applies to all the categorical variables. When the default ORDER=FORMATTED is in effect for numeric variables for which you have supplied no explicit format, the levels are ordered by their internal values.
specifies percentiles you want the procedure to compute. You can separate values with blanks or commas. Each value must be between 0 and 100. You can also use the statistickeywords DECILES, MEDIAN, Q1, Q3, and QUARTILES to request common percentiles.
PROC SURVEYMEANS uses Woodruff method (Dorfman and Valliant 1993; Särndal, Swensson, and Wretman 1992; Francisco and Fuller 1991) to estimate the variances of quantiles. BRR and jackknife variance estimation do not apply to the variance estimation for percentiles. See the section Quantiles for more details.
specifies quantiles you want the procedure to compute. You can separate values with blanks or commas. Each value must be between 0 and 1. You can also use the statistickeywords DECILES, MEDIAN, Q1, Q3, and QUARTILES to request common quantiles.
PROC SURVEYMEANS uses Woodruff method (Dorfman and Valliant 1993; Särndal, Swensson, and Wretman 1992; Francisco and Fuller 1991) to estimate the variances of quantiles. BRR and jackknife variance estimation do not apply to the variance estimation for quantiles. See the section Quantiles for more details.
specifies the sampling rate as a nonnegative value, or specifies an input data set that contains the stratum sampling rates. The procedure uses this information to compute a finite population correction for Taylor series variance estimation. The procedure does not use the RATE= option for BRR or jackknife variance estimation, which you request with the VARMETHOD=BRR or VARMETHOD=JACKKNIFE option.
If your sample design has multiple stages, you should specify the firststage sampling rate, which is the ratio of the number of PSUs selected to the total number of PSUs in the population.
For a nonstratified sample design, or for a stratified sample design with the same sampling rate in all strata, you should specify a nonnegative value for the RATE= option. If your design is stratified with different sampling rates in the strata, then you should name a SAS data set that contains the stratification variables and the sampling rates. See the section Specification of Population Totals and Sampling Rates for more details.
The value in the RATE= option or the values of _RATE_ in the secondary data set must be nonnegative numbers. You can specify value as a number between 0 and 1. Or you can specify value in percentage form as a number between 1 and 100, and PROC SURVEYMEANS converts that number to a proportion. The procedure treats the value 1 as 100%, and not the percentage form 1%.
If you do not specify the TOTAL= or RATE= option, then the Taylor series variance estimation does not include a finite population correction. You cannot specify both the TOTAL= and RATE= options.
requests that the procedure produce the output data sets by using a stacking table structure, which was the default before SAS 9. The new default is to produce a rectangular table structure in the output data sets.
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.
The STACKING option affects the following tables:
Domain
Ratio
Statistics
StrataInfo
See the section Rectangular and Stacking Structures in an Output Data Set for more details.
specifies the total number of primary sampling units in the study population as a positive value, or specifies an input data set that contains the stratum population totals. The procedure uses this information to compute a finite population correction for Taylor series variance estimation. The procedure does not use the TOTAL= option for BRR or jackknife variance estimation, which you request with the VARMETHOD=BRR or VARMETHOD=JACKKNIFE option.
For a nonstratified sample design, or for a stratified sample design with the same population total in all strata, you should specify a positive value for the TOTAL= option. If your sample design is stratified with different population totals in the strata, then you should name a SAS data set that contains the stratification variables and the population totals. See the section Specification of Population Totals and Sampling Rates for more details.
If you do not specify the TOTAL= or RATE= option, then the Taylor series variance estimation does not include a finite population correction. You cannot specify both the TOTAL= and RATE= options.
specifies the statistics for the procedure to compute. If you do not specify any statistickeywords, PROC SURVEYMEANS computes the NOBS, MEAN, STDERR, and CLM statistics by default.
The statistics produced depend on the type of the analysis variable. If you name a numeric variable in the CLASS statement, then the procedure analyzes that variable as a categorical variable. The procedure always analyzes character variables as categorical. See the section CLASS Statement for more information.
PROC SURVEYMEANS computes MIN, MAX, and RANGE for numeric variables but not for categorical variables. For numeric variables, the keyword MEAN produces the mean, but for categorical variables it produces the proportion in each category or level. Also, for categorical variables, the keyword NOBS produces the number of observations for each variable level, and the keyword NMISS produces the number of missing observations for each level. If you request the keyword NCLUSTER for a categorical variable, PROC SURVEYMEANS displays for each level the number of clusters with observations in that level. PROC SURVEYMEANS computes SUMWGT in the same way for both categorical and numeric variables, as the sum of the weights over all nonmissing observations.
PROC SURVEYMEANS performs univariate analysis, analyzing each variable separately. Thus the number of nonmissing and missing observations might not be the same for all analysis variables. See the section Missing Values for more information.
When you use a RATIO statement, available statistics computed for a ratio include N, NCLU, SUMWGT, RATIO, STDERR, DF, T, PROBT, and CLM, as shown in the following list. If no statistics are requested, the procedure computes the ratio and its standard error by default for a RATIO statement.
The valid statistickeywords are as follows:
all statistics listed
% twosided confidence limits for the MEAN, where is determined by the ALPHA= option; the default is
% twosided confidence limits for the SUM, where is determined by the ALPHA= option; the default is
coefficient of variation for MEAN
coefficient of variation for SUM
the 10th, the 20th, ..., and the 90th percentiles including their standard errors and confidence limits
degrees of freedom for the t test
% onesided lower confidence limit of the MEAN, where is determined by the ALPHA= option; the default is
% onesided lower confidence limit of the SUM, where is determined by the ALPHA= option; the default is
maximum value
mean for a numeric variable, or the proportion in each category for a categorical variable
median for a numeric variable
minimum value
number of clusters
number of missing observations
number of nonmissing observations
lower quartile
upper quartile
lower quartile (25%th percentile), median (50%th percentile), and upper quartile (75%th percentile), including their standard errors and confidence limits
range, MAXMIN
standard deviation of the SUM. When you request SUM, the procedure computes STD by default.
standard error of the MEAN or RATIO. When you request MEAN or RATIO, the procedure computes STDERR by default.
weighted sum, , or estimated population total when the appropriate sampling weights are used
sum of the weights,
tvalue and its corresponding pvalue with DF degrees of freedom for
where is a requested statistic
% onesided upper confidence limit of the MEAN, where is determined by the ALPHA= option; the default is
% onesided upper confidence limit of the SUM, where is determined by the ALPHA= option; the default is
variance of the MEAN or RATIO
variance of the SUM
See the section Statistical Computations for details about how PROC SURVEYMEANS computes these statistics.
specifies the variance estimation method. VARMETHOD=TAYLOR requests the Taylor series method, which is the default if you do not specify the VARMETHOD= option or the REPWEIGHTS statement. VARMETHOD=BRR requests variance estimation by balanced repeated replication (BRR), and VARMETHOD=JACKKNIFE requests variance estimation by the delete1 jackknife method.
For VARMETHOD=BRR and VARMETHOD=JACKKNIFE you can specify methodoptions in parentheses. Table 85.2 summarizes the available methodoptions.
Keyword 
Method 
(MethodOptions) 

Balanced repeated replication 
DFADJ 

FAY <=value> 

HADAMARD  H=SASdataset 

OUTWEIGHTS=SASdataset 

PRINTH 

REPS=number 

Jackknife 
DFADJ 

OUTJKCOEFS=SASdataset 

OUTWEIGHTS=SASdataset 

TAYLOR 
Taylor series 
Methodoptions must be enclosed in parentheses following the method keyword. For example:
varmethod=BRR(reps=60 outweights=myReplicateWeights)
The following values are available for the VARMETHOD= option:
requests balanced repeated replication (BRR) variance estimation. The BRR method requires a stratified sample design with two primary sampling units (PSUs) per stratum. See the section Balanced Repeated Replication (BRR) Method for more information.
You can specify the following methodoptions in parentheses following VARMETHOD=BRR.
computes the degrees of freedom as the number of nonmissing strata for an analysis variable. The degrees of freedom for VARMETHOD=BRR equal the number of strata, which by default is based on all valid observations in the data set. But if you specify the DFADJ methodoption, PROC SURVEYMEANS does not count any empty strata due to all observations containing missing values for an analysis variable.
See the section Degrees of Freedom for more information. See the section Data and Sample Design Summary for details about valid observations.
The DFADJ methodoption has no effect on categorical variables when you specify the MISSING option, which treats missing values as a valid nonmissing level.
The DFADJ methodoption cannot be used when you provide replicate weights with a REPWEIGHTS statement. When you use a REPWEIGHTS statement, the degrees of freedom equal the number of REPWEIGHTS variables (or replicates), unless you specify an alternative value in the DF= option in the REPWEIGHTS statement.
requests Fay’s method, a modification of the BRR method, for variance estimation. See the section Fay’s BRR Method for more information.
You can specify the value of the Fay coefficient, which is used in converting the original sampling weights to replicate weights. The Fay coefficient must be a nonnegative number less than 1. By default, the value of the Fay coefficient equals 0.5.
names a SAS data set that contains the Hadamard matrix for BRR replicate construction. If you do not provide a Hadamard matrix with the HADAMARD= methodoption, PROC SURVEYMEANS generates an appropriate Hadamard matrix for replicate construction. See the sections Balanced Repeated Replication (BRR) Method and Hadamard Matrix for details.
If a Hadamard matrix of a given dimension exists, it is not necessarily unique. Therefore, if you want to use a specific Hadamard matrix, you must provide the matrix as a SAS data set in the HADAMARD=SASdataset methodoption.
In the HADAMARD= input data set, each variable corresponds to a column of the Hadamard matrix, and each observation corresponds to a row of the matrix. You can use any variable names in the HADAMARD= data set. All values in the data set must equal either or . You must ensure that the matrix you provide is indeed a Hadamard matrix—that is, , where is the Hadamard matrix of dimension and is an identity matrix. PROC SURVEYMEANS does not check the validity of the Hadamard matrix that you provide.
The HADAMARD= input data set must contain at least variables, where denotes the number of firststage strata in your design. If the data set contains more than variables, the procedure uses only the first variables. Similarly, the HADAMARD= input data set must contain at least observations.
If you do not specify the REPS= methodoption, then the number of replicates is taken to be the number of observations in the HADAMARD= input data set. If you specify the number of replicates—for example, REPS=nreps—then the first nreps observations in the HADAMARD= data set are used to construct the replicates.
You can specify the PRINTH option to display the Hadamard matrix that the procedure uses to construct replicates for BRR.
names a SAS data set that contains replicate weights. See the section Balanced Repeated Replication (BRR) Method for information about replicate weights. See the section Replicate Weights Output Data Set for more details about the contents of the OUTWEIGHTS= data set.
The OUTWEIGHTS= methodoption is not available when you provide replicate weights with the REPWEIGHTS statement.
When you provide your own Hadamard matrix with the HADAMARD= methodoption, only the rows and columns of the Hadamard matrix that are used by the procedure are displayed. See the sections Balanced Repeated Replication (BRR) Method and Hadamard Matrix for details.
The PRINTH methodoption is not available when you provide replicate weights with the REPWEIGHTS statement because the procedure does not use a Hadamard matrix in this case.
specifies the number of replicates for BRR variance estimation. The value of number must be an integer greater than 1.
If you do not provide a Hadamard matrix with the HADAMARD= methodoption, the number of replicates should be greater than the number of strata and should be a multiple of 4. See the section Balanced Repeated Replication (BRR) Method for more information. If a Hadamard matrix cannot be constructed for the REPS= value that you specify, the value is increased until a Hadamard matrix of that dimension can be constructed. Therefore, it is possible for the actual number of replicates used to be larger than the REPS= value that you specify.
If you provide a Hadamard matrix with the HADAMARD= methodoption, the value of REPS= must not be less than the number of rows in the Hadamard matrix. If you provide a Hadamard matrix and do not specify the REPS= methodoption, the number of replicates equals the number of rows in the Hadamard matrix.
If you do not specify the REPS= or HADAMARD= methodoption and do not include a REPWEIGHTS statement, the number of replicates equals the smallest multiple of 4 that is greater than the number of strata.
If you provide replicate weights with the REPWEIGHTS statement, the procedure does not use the REPS= methodoption. With a REPWEIGHTS statement, the number of replicates equals the number of REPWEIGHTS variables.
requests variance estimation by the delete1 jackknife method. See the section Jackknife Method for details. If you provide replicate weights with a REPWEIGHTS statement, VARMETHOD=JACKKNIFE is the default variance estimation method.
You can specify the following methodoptions in parentheses following VARMETHOD=JACKKNIFE:
computes the degrees of freedom as the number of nonmissing strata for an analysis variable. The degrees of freedom for VARMETHOD=BRR equal the number of strata, which by default is based on all valid observations in the data set. But if you specify the DFADJ methodoption, PROC SURVEYMEANS does not count any empty strata due to all observations containing missing values for an analysis variable.
See the section Degrees of Freedom for more information. See the section Data and Sample Design Summary for details about valid observations.
The DFADJ methodoption has no effect on categorical variables when you specify the MISSING option, which treats missing values as a valid nonmissing level.
The DFADJ methodoption cannot be used when you provide replicate weights with a REPWEIGHTS statement. When you use a REPWEIGHTS statement, the degrees of freedom equal the number of REPWEIGHTS variables (or replicates), unless you specify an alternative value in the DF= option in the REPWEIGHTS statement.
names a SAS data set that contains replicate weights. See the section Jackknife Method for information about replicate weights. See the section Replicate Weights Output Data Set for more details about the contents of the OUTWEIGHTS= data set.
The OUTWEIGHTS= methodoption is not available when you provide replicate weights with the REPWEIGHTS statement.
names a SAS data set that contains jackknife coefficients. See the section Jackknife Method for information about jackknife coefficients. See the section Jackknife Coefficients Output Data Set for more details about the contents of the OUTJKCOEFS= data set.
requests Taylor series variance estimation. This is the default method if you do not specify the VARMETHOD= option and if there is no REPWEIGHTS statement. See the section Statistical Computations for more information.
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.