The SURVEYREG Procedure
PROC SURVEYREG Statement
PROC SURVEYREG <options>;
The PROC SURVEYREG statement invokes the SURVEYREG procedure. It optionally names the input data sets and specifies the variance estimation method.
Table 116.2 summarizes the options available in the PROC SURVEYREG statement.
Table 116.2: PROC SURVEYREG Statement Options
Option | Description |
|---|---|
Sets the confidence level | |
Specifies the SAS data set to be analyzed | |
Treats missing values as a valid category | |
Specifies the length of effect names | |
Treats missing values as not missing completely at random | |
Specifies the sort order | |
Requests plots from ODS Graphics | |
Specifies the sampling rate | |
Specifies the total number of primary sampling units | |
Specifies class levels using no more than the first 16 characters of the formatted values | |
Specifies the variance estimation method |
You can specify the following options in the PROC SURVEYREG statement:
- ALPHA=
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.
- DATA=SAS-data-set
specifies the SAS data set to be analyzed by PROC SURVEYREG. If you omit the DATA= option, the procedure uses the most recently created SAS data set.
- MISSING
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.
- NAMELEN=n
specifies the length of effect names in tables and output data sets to be n characters, where n is a value between 40 and 200. The default length is 40 characters.
- NOMCAR
treats that missing values in the variance computation as not missing completely at random (NOMCAR) for Taylor series variance estimation. When you specify this option, PROC SURVEYREG computes variance estimates by analyzing the nonmissing values as a domain or subpopulation, where the entire population includes both nonmissing and missing domains. For more information, see the section Missing Values.
By default, PROC SURVEYREG 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 classification 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; it is ignored for replication methods.
- ORDER=DATA | FORMATTED | FREQ | INTERNAL
specifies the sort order for the levels of the classification variables (which are specified in the CLASS statement).
This option also determines the sort order for the levels of DOMAIN variables.
This option applies to the levels for all classification variables, except when you use the (default) ORDER=FORMATTED option with numeric classification variables that have no explicit format. In that case, the levels of such variables are ordered by their internal value.
The ORDER= option can take the following values:
Value of ORDER=
Levels Sorted By
DATA
Order of appearance in the input data set
FORMATTED
External formatted value, except for numeric variables with no explicit format, which are sorted by their unformatted (internal) value
FREQ
Descending frequency count; levels with the most observations come first in the order
INTERNAL
Unformatted value
By default, ORDER=FORMATTED. For ORDER=FORMATTED and ORDER=INTERNAL, the sort order is machine-dependent.
For more information about sort order, see the chapter on the SORT procedure in the Base SAS Procedures Guide and the discussion of BY-group processing in SAS Language Reference: Concepts.
-
PLOTS < ( global-plot-options ) > < = plot-request < (plot-option) > >
PLOTS < ( global-plot-options ) > < = ( plot-request < (plot-option) > <…plot-request < (plot-option) >> )> controls the plots that are produced through ODS Graphics.
When ODS Graphics is enabled and when the regression model depends on at most one continuous variable as a regressor, excluding the intercept, the PLOTS= option in the PROC SURVEYREG statement controls fit plots for the regression.
A plot-request identifies the plot, and a plot-option controls the appearance and content of the plot. You can specify plot-options in parentheses after a plot-request. A global-plot-option applies to all plots for which it is available unless it is altered by a specific plot-option. You can specify global-plot-options in parentheses after the PLOTS option.
When you specify only one plot-request, you can omit the parentheses around it. Here are a few examples of requesting plots:
plots=all plots(weight=heatmap)=fit
When the regression model depends on at most one continuous variable as a regressor, excluding the intercept, PROC SURVEYREG provides a bubble plot or a heat map for model fitting. In a bubble plot, the bubble area is proportional to the weight of an observation. In a heat map, the heat color represents the sum of the weights at the corresponding location. The default plot depends on the number of observations in your data. That is, for a data set that contains 100 observations or less, a bubble plot is the default. For a data set that contains more than 100 observations, a heat map is the default.
ODS Graphics must be enabled before you can request a plot. For example:
ods graphics on; proc surveyreg plots=fit; model height=weight; run;
For more information about enabling and disabling ODS Graphics, see the section Enabling and Disabling ODS Graphics in Chapter 21: Statistical Graphics Using ODS.
When ODS Graphics is enabled, the ESTIMATE, LSMEANS, LSMESTIMATE, and SLICE statements can produce plots that are associated with their analyses. For information about these plots, see the corresponding sections of Chapter 19: Shared Concepts and Topics.
For general information about ODS Graphics, see Chapter 21: Statistical Graphics Using ODS.
Global Plot Option
A global-plot-option applies to all plots for which the option is available unless it is altered by a specific plot-option. You can specify the following global-plot-options:
- ONLY
suppresses the default plots and requests only the plots that are specified as plot-requests.
- NBINS=nbin1 <nbin2>
specifies the number of bins for the heat map of the observation weights in the fit plot. The number of bins also depends on the value of the SHAPE= option:
If SHAPE=RECTANGULAR, the number of bins is calculated as follows:
If you specify only one number, nbin1, then it is used for both the horizontal and vertical axes. For example, if you specify NBINS=10, then PROC SURVEYREG creates 100 bins ().
If you specify two numbers, then nbin1 is used for the horizontal axis and nbin2 is used for the vertical axis. For example, if you specify NBINS=10 20, then PROC SURVEYREG creates 200 bins ().
If you specify SHAPE=HEXAGONAL, then PROC SURVEYREG calculates the number of rectangular bins by the method previously described. Then the procedure creates a heat map that has hexagonal bins of approximately the same size as those rectangular bins.
If you specify this option, then by default WEIGHT=HEATMAP.
If you do not specify this option, then the number of bins is determined by first using the algorithm that is discussed in the section ODS Graphics in Chapter 67: The KDE Procedure, and then multiplying the resulting numbers of bins by three.
- WEIGHT=BUBBLE | HEATMAP
requests either a bubble plot or a heat map of the data as an overlay on the regression line and confidence limits band of the prediction in a fit plot. You can specify the following options:
- BUBBLE
overlays a bubble plot in which the bubble area is proportional to the weight of an observation.
- HEATMAP
overlays a heat map in which the heat color represents the sum of the weights at the corresponding location.
If you specify the NBINS= option, then by default WEIGHT=HEATMAP.
If you do not specify this option, then the default plot depends on the number of observations in your data. For a data set that contains 100 observations or less, the default is WEIGHT=BUBBLE. For a data set that contains more than 100 observations, the default is WEIGHT=HEATMAP.
Plot Requests
You can specify the following plot-requests:
- ALL
requests all appropriate plots.
- FIT < (plot-options) >
requests a plot that displays the model fitting for a model that depends on at most one regressor, excluding the intercept. The plot is either a bubble plot or a heat map that is overlaid with the regression line and confidence band of the prediction.
The FIT plot request has the following plot-options:
- NBINS=nbin1 <nbin2>
specifies the number of bins for the heat map of the observation weights in the fit plot. The number of bins also depends on the value of the SHAPE= option:
If SHAPE=RECTANGULAR, the number of bins is calculated as follows:
If you specify only one number, nbin1, then it is used for both the horizontal and vertical axes. For example, if you specify NBINS=10, then PROC SURVEYREG creates 100 bins ().
If you specify two numbers, then nbin1 is used for the horizontal axis and nbin2 is used for the vertical axis. For example, if you specify NBINS=10 20, then PROC SURVEYREG creates 200 bins ().
If you specify SHAPE=HEXAGONAL, then PROC SURVEYREG calculates the number of rectangular bins by the method previously described. Then the procedure creates a heat map that has hexagonal bins of approximately the same size as those rectangular bins.
If you specify this option, then by default WEIGHT=HEATMAP.
If you do not specify this option, then the number of bins is determined by first using the algorithm that is discussed in the section ODS Graphics in Chapter 67: The KDE Procedure, and then multiplying the resulting numbers of bins by three.
- WEIGHT=BUBBLE | HEATMAP
requests either a bubble plot or a heat map of the data as an overlay on the regression line and confidence limits band of the prediction in a fit plot. You can specify the following options:
- BUBBLE
overlays a bubble plot in which the bubble area is proportional to the weight of an observation.
- HEATMAP
overlays a heat map in which the heat color represents the sum of the weights at the corresponding location.
If you specify the NBINS= option, then by default WEIGHT=HEATMAP.
If you do not specify this option, then the default plot depends on the number of observations in your data. For a data set that contains 100 observations or less, the default is WEIGHT=BUBBLE. For a data set that contains more than 100 observations, the default is WEIGHT=HEATMAP.
-
SHAPE=RECTANGULAR | HEXAGONAL
SHAPE=REC | HEX requests either rectangular or hexagonal bins for a heat map of the data. Thus, this option implies WEIGHT=HEATMAP by default. By default, SHAPE=RECTANGULAR.
- NONE
suppresses all plots.
-
RATE=value | SAS-data-set
R=value | SAS-data-set specifies the sampling rate, which PROC SURVEYREG uses to compute a finite population correction for Taylor series variance estimation. This option is ignored for replication variance estimation methods.
If your sample design has multiple stages, you should specify the first-stage sampling rate, which is the ratio of the number of primary sampling units (PSUs) in the sample to the total number of PSUs in the population.
You can specify the sampling rate in either of the following ways:
- value
specifies a nonnegative number to use for a nonstratified design or for a stratified design that has the same sampling rate in each stratum.
- SAS-data-set
specifies a SAS-data-set that contains the stratification variables and the sampling rates for a stratified design that has different sampling rates in the strata. You must provide the sampling rates in the data set variable named
_RATE_. The sampling rates must be nonnegative numbers.
You can specify sampling rates as numbers between 0 and 1. Or you can specify sampling rates in percentage form as numbers between 1 and 100, which PROC SURVEYREG converts to proportions. The procedure treats the value 1 as 100% instead of 1%.
For more information, see the section Specification of Population Totals and Sampling Rates.
If you do not specify either the RATE= or the TOTAL= option, the Taylor series variance estimation does not include a finite population correction. You cannot specify both the RATE= and TOTAL= options.
-
TOTAL=value | SAS-data-set
N=value | SAS-data-set specifies the total number of primary sampling units (PSUs) in the study population. PROC SURVEYREG uses this information to compute a finite population correction for Taylor series variance estimation. This option is ignored for replication variance estimation methods.
You can specify the total number of PSUs in either of the following ways:
- value
specifies a positive number to use for a nonstratified design or for a stratified design that has the same population total in each stratum.
- SAS-data-set
specifies a SAS-data-set that contains the stratification variables and the population totals for a stratified design that has different population totals in the strata. You must provide the stratum totals in the data set variable named
_TOTAL_. The stratum totals must be positive numbers.
For more information, see the section Specification of Population Totals and Sampling Rates.
If you do not specify either the TOTAL= or the RATE= option, the Taylor series variance estimation does not include a finite population correction. You cannot specify both the TOTAL= and RATE= options.
- TRUNCATE
specifies that class levels should be determined using no more than the first 16 characters of the formatted values of the CLASS, STRATA, and CLUSTER variables. When formatted values are longer than 16 characters, you can use this option in order to revert to the levels as determined in releases before SAS 9.
- VARMETHOD=method <(method-options)>
specifies the variance estimation method. PROC SURVEYREG provides the Taylor series method and the following replication (resampling) methods: balanced repeated replication (BRR), jackknife, and bootstrap.
Table 116.3 summarizes the available methods and method-options.
Table 116.3: Variance Estimation Methods
method
Variance Estimation Method
method-options
None
Taylor series linearization
None
For VARMETHOD=BRR and VARMETHOD=JACKKNIFE, you can specify method-options in parentheses after the variance method name. For example:
varmethod=BRR(reps=60 outweights=myReplicateWeights)
By default, VARMETHOD=JACKKNIFE if you also specify a REPWEIGHTS statement; otherwise, VARMETHOD=TAYLOR by default.
You can specify the following methods:
- BOOTSTRAP
requests bootstrap variance estimation. When you specify this option, you must also provide bootstrap replicate weights by using the REPWEIGHTS statement; PROC SURVEYREG does not create bootstrap weights. For more information, see the section Bootstrap Method.
- BRR <(method-options)>
requests variance estimation by balanced repeated replication (BRR). This method requires a stratified sample design where each stratum contains two primary sampling units (PSUs). When you specify this method, you must also specify a STRATA statement unless you provide replicate weights by using the REPWEIGHTS statement. For more information, see the section Balanced Repeated Replication (BRR) Method.
You can specify the following method-options:
- FAY <=value>
requests Fay’s method, which is a modification of the BRR method. For more information, see the section Fay’s BRR Method.
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 Fay coefficient is 0.5.
-
HADAMARD=SAS-data-set
H=SAS-data-set names a SAS-data-set that contains the Hadamard matrix for BRR replicate construction. If you do not specify this method-option, PROC SURVEYREG generates an appropriate Hadamard matrix for replicate construction. For more information, see the sections Balanced Repeated Replication (BRR) Method and Hadamard Matrix.
If a Hadamard matrix of a particular 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 this method-option.
In this SAS-data-set, each variable corresponds to a column and each observation corresponds to a row of the Hadamard matrix. You can use any variable names in this data set. All values in the data set must equal either 1 or –1. You must ensure that the matrix you provide is indeed a Hadamard matrix—that is, , where is the Hadamard matrix of dimension R and is an identity matrix. PROC SURVEYREG does not check the validity of the Hadamard matrix that you provide.
The SAS-data-set must contain at least H variables, where H denotes the number of first-stage strata in your design. If the data set contains more than H variables, PROC SURVEYREG uses only the first H variables. Similarly, this data set must contain at least H observations.
If you do not specify the REPS= method-option, the number of replicates is assumed to be the number of observations in the SAS-data-set. If you specify the number of replicates—for example, REPS=nreps—the first nreps observations in the SAS-data-set are used to construct the replicates.
You can specify the PRINTH method-option to display the Hadamard matrix that PROC SURVEYREG uses to construct replicates for BRR.
- OUTWEIGHTS=SAS-data-set
names a SAS-data-set to store the replicate weights that PROC SURVEYREG creates for BRR variance estimation. For information about replicate weights, see the section Balanced Repeated Replication (BRR) Method. For information about the contents of the OUTWEIGHTS= data set, see the section Replicate Weights Output Data Set.
This method-option is not available when you provide replicate weights in a REPWEIGHTS statement.
- PRINTH
displays the Hadamard matrix that PROC SURVEYREG uses to construct replicates for BRR variance estimation. When you provide the Hadamard matrix in the HADAMARD= method-option, PROC SURVEYREG displays only the rows and columns that are actually used to construct replicates. For more information, see the sections Balanced Repeated Replication (BRR) Method and Hadamard Matrix.
The PRINTH method-option is not available when you provide replicate weights in a REPWEIGHTS statement because the procedure does not use a Hadamard matrix in this case.
- REPS=number
specifies the number of replicates for BRR variance estimation. The value of number must be an integer greater than 1.
If you do not use the HADAMARD= method-option to provide a Hadamard matrix, the number of replicates should be greater than the number of strata and should be a multiple of 4. For more information, see the section Balanced Repeated Replication (BRR) Method. If PROC SURVEYREG cannot construct a Hadamard matrix for the REPS= value that you specify, the value is increased until a Hadamard matrix of that dimension can be constructed. Therefore, the actual number of replicates that PROC SURVEYREG uses might be larger than number.
If you use the HADAMARD= method-option to provide a Hadamard matrix, the value of number must not be greater than the number of rows in the Hadamard matrix. If you provide a Hadamard matrix and do not specify the REPS= method-option, the number of replicates is the number of rows in the Hadamard matrix.
If you do not specify the REPS= or the HADAMARD= method-option and do not use a REPWEIGHTS statement, the number of replicates is the smallest multiple of 4 that is greater than the number of strata.
If you use a REPWEIGHTS statement to provide replicate weights, PROC SURVEYREG does not use the REPS= method-option; the number of replicates is the number of REPWEIGHTS variables.
-
JACKKNIFE <(method-options)>
JK <(method-options)> requests variance estimation by the delete-1 jackknife method. For more information, see the section Jackknife Method. If you use a REPWEIGHTS statement to provide replicate weights, VARMETHOD=JACKKNIFE is the default variance estimation method.
The delete-1 jackknife method requires at least two primary sampling units (PSUs) in each stratum for stratified designs unless you use a REPWEIGHTS statement to provide replicate weights.
You can specify the following method-options:
- OUTJKCOEFS=SAS-data-set
names a SAS-data-set in which to store the jackknife coefficients. For information about jackknife coefficients, see the section Jackknife Method. For information about the contents of the OUTJKCOEFS= data set, see the section Jackknife Coefficients Output Data Set.
- OUTWEIGHTS=SAS-data-set
names a SAS-data-set in which to store the replicate weights that PROC SURVEYREG creates for jackknife variance estimation. For information about replicate weights, see the section Jackknife Method. For information about the contents of the OUTWEIGHTS= data set, see the section Replicate Weights Output Data Set.
This method-option is not available when you use a REPWEIGHTS statement to provide replicate weights.
- TAYLOR
requests Taylor series variance estimation. This is the default method if you do not specify the VARMETHOD= option or a REPWEIGHTS statement. For more information, see the section Taylor Series (Linearization).
Copyright © SAS Institute Inc. All rights reserved.