11.2 - Specifying Statistics11.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.
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; RUN;
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:
|CLM||Two-sided confidence limit for the mean|
|CSS||Corrected sum of squares|
|CV||Coefficient of variation|
|LCLM||One-sided confidence limit below the mean|
|N||No. of observations with non-missing values|
|NMISS||No. of observations with missing values|
|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|
|MEDIAN or P50||Median or 50th percentile|
|Q1 or P25||Lower quartile or 25th percentile|
|Q3 or P75||Upper quartile or 75th percentile|
|QRANGE||Difference between upper and lower quartiles: Q3-Q1|
|PROBT||Probability of a greater absolute value for the t value|
|T||Student's t for testing that the population mean is 0|