WEIGHT
variable ;
The WEIGHT statement specifies numeric weights for analysis variables in the statistical calculations. The UNIVARIATE procedure uses the values of the WEIGHT variable to modify the computation of a number of summary statistics by assuming that the variance of the th value of the analysis variable is equal to , where is an unknown parameter. The values of the WEIGHT variable do not have to be integers and are typically positive. By default, observations with nonpositive or missing values of the WEIGHT variable are handled as follows:
If the value is zero, the observation is counted in the total number of observations.
If the value is negative, it is converted to zero, and the observation is counted in the total number of observations.
If the value is missing, the observation is excluded from the analysis.
To exclude observations that contain negative and zero weights from the analysis, use EXCLNPWGT. Note that most SAS/STAT procedures, such as PROC GLM, exclude negative and zero weights by default. The weight variable does not change how the procedure determines the range, mode, extreme values, extreme observations, or number of missing values. When you specify a WEIGHT statement, the procedure also computes a weighted standard error and a weighted version of Student’s test. The Student’s test is the only test of location that PROC UNIVARIATE computes when you weight the analysis variables.
When you specify a WEIGHT variable, the procedure uses its values, , to compute weighted versions of the statistics provided in the Moments table. For example, the procedure computes a weighted mean and a weighted variance as
and
where is the th variable value. The divisor is controlled by the VARDEF= option in the PROC UNIVARIATE statement.
The WEIGHT statement does not affect the determination of the mode, extreme values, extreme observations, or the number of missing values of the analysis variables. However, the weights are used to compute weighted percentiles. The WEIGHT variable has no effect on graphical displays produced with the plot statements.
The CIPCTLDF, CIPCTLNORMAL, LOCCOUNT, NORMAL, ROBUSTSCALE, TRIMMED=, and WINSORIZED= options are not available with the WEIGHT statement.
To compute weighted skewness or kurtosis, use VARDEF=DF or VARDEF=N in the PROC statement.
You cannot specify the HISTOGRAM, PROBPLOT, or QQPLOT statements with the WEIGHT statement.
When you use the WEIGHT statement, consider which value of the VARDEF= option is appropriate. See VARDEF= and the calculation of weighted statistics for more information.