SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Computing Statistics for Numeric Variables
Lesson Summary

This page contains


I. Text Summary

To go to the page where a task, programming feature, or concept was presented, select a link.

Purpose of PROC MEANS
The MEANS procedure provides an easy way to compute descriptive statistics. These data summarization tools can answer basic questions about numeric variables.

Specifying Statistics
By default, PROC MEANS computes the n-count (number of non-missing values), mean, standard deviation, minimum, and maximum for variables. To specify statistics, list their keywords in the PROC MEANS statement.


Descriptive Statistics
 
 CLM Two-sided confidence limit for the mean
 CSS Corrected sum of squares
 CV Coefficient of variation
 KURTOSIS Kurtosis
 LCLM One-sided confidence limit below the mean
 MAX Maximum value
 MEAN Average
 MIN Minimun value
 N Number of observations with nonmissing values
 NMISS Number of observations with missing values
 RANGE Range
 SKEWNESS Skewness
 STDDEV / STD  Standard Deviation
 STDERR Standard error of the mean
 SUM Sum
 SUMWGT Sum of the Weight variable values.
 UCLM One-sided confidence limit above the mean
 USS Uncorrected sum of squares
 VAR Variance
 
Quantile Statistics
 
 MEDIAN / P50  Median or 50th percentile
 P1 1st percentile
 P5 5th percentile
 P10 10th percentile
 Q1 / P25 Lower quartile or 25th percentile
 Q3 / 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
 
 PROBT  Probability of a greater absolute value for the t value
 T Student's t for testing the hypothesis that the population mean is 0
 


Limiting Decimal Places
Because PROC MEANS normally uses the BEST. format, procedure output can contain unnecessary decimal places. To limit decimal places, use the MAXDEC= option and set it equal to the length you prefer.

Specifying Variables
By default, PROC MEANS computes statistics for all numeric variables. To specify the variables to include in MEANS output, list them in a VAR statement.

CLASS Group Processing
Include a CLASS statement, specifying variable names, to group PROC MEANS output by variable values. Statistics for the CLASS variables will not be computed.

BY Group Processing
Include a BY statement, specifying variable names, to group PROC MEANS output by variable values. Your data must be sorted according to those variables; statistics for the BY variables will not be computed.


II. Syntax

To go to the page where a statement or option was presented, select a link.

PROC MEANS <DATA=SAS-data-set>
<statistic-keyword(s)> <option(s)>
<VAR variable(s)>;
<CLASS variable(s)>;
<BY variable(s)>;
RUN;


III. Sample Programs
proc means data=clinic.heart min max maxdec=1;
   var arterial heart cardiac urinary;
   class survive sex;
run;

proc sort data=clinic.heart out=work.hartsort;
   by survive sex;
run;
proc means data=work.hartsort maxdec=1;
   var arterial heart cardiac urinary;
   by survive sex;
run;


IV. Points to Remember

  • Use a VAR statement to limit output to relevant variables. Exclude statistics for such nominal variables as ID or ProductCode.

  • By default, PROC MEANS prints the full width of each numeric variable. Use the MAXDEC= option to limit decimal places and improve legibility.

  • Data must be sorted for BY group processing. You may need to run PROC SORT before using PROC MEANS with a BY statement.


back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement