# Introduction to SAS: Proc Means

Download the SAS Tutorial in a single PDF file from the SAS Tutorial page. The online tutorial will be eliminated in August 2017.

Proc means is used to compute simple statistics from a data set. Here is an example using some of the most common options.

``````proc means
data=first
alpha=0.10
vardef=n
mean std t prt n lclm uclm;
var x y;
by x;
run;
``````

The required `data=first` statement selects the data set used in the analysis.

The `alpha=` option sets the significance level for any confidence intervals computed (defaults to alpha=0.05 if not specified).

The `vardef=n` option sets the divisor for the sample variance to be the sample size n (default is to use the degrees of freedom n-1 and is the same as `vardef=df`). NOTE: do not use the `vardef` option if you also use the `t` and/or `prt` options. THE T AND PRT VALUES GENERATED WHEN VARDEF=N ARE INCORRECT.

The optional last line gives a list of the statistics to be computed. The `mean` and `std` options give the sample mean and sample standard deviation for each variable in the analysis.

The `t` option computes the value of the t-statitistic for a test of zero mean for each variable.

The `prt` option computes the p-value for a test of the null hypothesis of zero mean for each variable.

The `n` option prints the sample size.

The `lclm` and `uclm` options produce the lower and upper endpoints of a 100(1-alpha)% confidence interval for the mean.

If no statistics are specified, `n mean std min` and `max` are printed for each variable. `Min` and `max` are the sample minimum value and maximum value.

The `var` option can be used to limit the output to a specific list of variables in the data set. If it is not used, the requested statistics will be computed for all variables in the data set.

The optional by statement generates separate analyses for each level of the by variable(s).

For additional information, see the online help under SAS SYSTEM HELP--MODELING & ANALYSIS TOOLS--DATA ANALYSIS--(ELEMENTARY)MEANS or the SAS Procedures Guide.