This section provides computational details for the descriptive statistics that are computed with the PROC UNIVARIATE statement. These statistics can also be saved in an OUT= data set by specifying keywords listed in Table 4.14 in the OUTPUT statement.
Standard algorithms (Fisher 1973) are used to compute the moment statistics. The computational methods used by the UNIVARIATE procedure are consistent with those used by other SAS procedures for calculating descriptive statistics.
The following sections give specific details on a number of statistics calculated by the UNIVARIATE procedure.
The sample mean is calculated as
where n is the number of nonmissing values for a variable, is the ith value of the variable, and is the weight associated with the ith value of the variable. If there is no WEIGHT variable, the formula reduces to
The sum is calculated as , where n is the number of nonmissing values for a variable, is the ith value of the variable, and is the weight associated with the ith value of the variable. If there is no WEIGHT variable, the formula reduces to .
The sum of the weights is calculated as , where n is the number of nonmissing values for a variable and is the weight associated with the ith value of the variable. If there is no WEIGHT variable, the sum of the weights is n.
The variance is calculated as
where n is the number of nonmissing values for a variable, is the ith value of the variable, is the weighted mean, is the weight associated with the ith value of the variable, and d is the divisor controlled by the VARDEF= option in the PROC UNIVARIATE statement:
If there is no WEIGHT variable, the formula reduces to
The standard deviation is calculated as
where n is the number of nonmissing values for a variable, is the ith value of the variable, is the weighted mean, is the weight associated with the ith value of the variable, and d is the divisor controlled by the VARDEF= option in the PROC UNIVARIATE statement. If there is no WEIGHT variable, the formula reduces to
The sample skewness, which measures the tendency of the deviations to be larger in one direction than in the other, is calculated as follows depending on the VARDEF= option:
Table 4.29: Formulas for Skewness
VARDEF 
Formula 

DF (default) 

N 

WDF 
missing 
WEIGHT  WGT 
missing 
where n is the number of nonmissing values for a variable, is the ith value of the variable, is the sample average, s is the sample standard deviation, and is the weight associated with the ith value of the variable. If VARDEF=DF, then n must be greater than 2. If there is no WEIGHT variable, then for all .
The sample skewness can be positive or negative; it measures the asymmetry of the data distribution and estimates the theoretical skewness , where and are the second and third central moments. Observations that are normally distributed should have a skewness near zero.
The sample kurtosis, which measures the heaviness of tails, is calculated as follows depending on the VARDEF= option:
Table 4.30: Formulas for Kurtosis
VARDEF 
Formula 

DF (default) 

N 

WDF 
missing 
WEIGHT  WGT 
missing 
where n is the number of nonmissing values for a variable, is the ith value of the variable, is the sample average, is the sample standard deviation, and is the weight associated with the ith value of the variable. If VARDEF=DF, then n must be greater than 3. If there is no WEIGHT variable, then for all .
The sample kurtosis measures the heaviness of the tails of the data distribution. It estimates the adjusted theoretical kurtosis denoted as , where , and is the fourth central moment. Observations that are normally distributed should have a kurtosis near zero.
The coefficient of variation is calculated as
The geometric mean is calculated as
where n is the number of nonmissing values for a variable, is the ith value of the variable, and is the weight associated with the ith value of the variable.
If there is no WEIGHT variable, the formula reduces to
If any is negative, the geometric mean is set to missing.