11.2 - Specifying Statistics

The default statistics that the MEANS procedure produces — N, mean, standard deviation, minimum, and maximum — might not be the ones that you actually need. You might prefer to limit your output to just the mean and standard deviation of the values. Or you might want to compute a completely different statistic, such as the median or range of values.

In order to tell SAS to calculate summary statistics other than those calculated by default, simply place the desired statistics keywords as options in the PROC MEANS statement.

Example 11.6 Section

The following program tells SAS to calculate and display the sum, range and median of the red blood cell counts appearing in the icdb.hem2 data set:

PROC MEANS data=icdb.hem2 fw=10 maxdec=2 sum range median;
    var rbc;
The MEANS Procedure
Analysis variable: rbc
Sum Range Median
2816.23 2.83 4.41

Launch and run the SAS program, and review the output to convince yourself that the report is generated as described. You might want to note, in particular, that when you specify a statistic in the PROC MEANS statement, the default statistics are not produced. Incidentally, you can generate the exact same report using the SUMMARY procedure, providing you again add the PRINT option to the end of the PROC statement.

The following keywords can be used with the MEANS and SUMMARY procedures to compute statistics:

Descriptive Statistics
Keyword Description
CLM Two-sided confidence limit for the mean
CSS Corrected sum of squares
CV Coefficient of variation
KURT Kurtosis
LCLM One-sided confidence limit below the mean
MAX Maximum value
MEAN Average value
MIN Minimum value
N No. of observations with non-missing values
NMISS No. of observations with missing values
SKEW Skewness
STD Standard deviation
STDERR Standard error of the mean
SUMWGT Sum of the Weight variable values
UCLM One-sided confidence limit above the mean
USS Uncorrected sum of squares
VAR Variance
Quantile Statistics
Keyword Description
MEDIAN or P50 Median or 50th percentile
P1 1st percentile
P5 5th percentile
P10 10th percentile
Q1 or P25 Lower quartile or 25th percentile
Q3 or P75 Upper quartile or 75th percentile
P90 90th percentile
P95 95th percentile
P99 99th percentile
QRANGE Difference between upper and lower quartiles: Q3-Q1
Hypothesis Testing
Keyword Description
PROBT Probability of a greater absolute value for the t value
T Student's t for testing that the population mean is 0