University of Southern California

ITS Information Technology Services

A division of the Office of the Chief Information Officer

Descriptive Statistics Using SAS

SAS produces the full range of statistical analyses, from descriptive to inferential, parametric, non-parametric, maximum likelihood and more. This documentation provides an introduction to a sampling of these techniques. For more information, two workshops, Introduction to SAS and Inferential Statistics using SAS, are offered through the ITS Adventures in Technology program.

Creating Descriptive Statistics

To create a frequency distribution using SAS, simply type:

proc freq data= datasetname ;
run;

Be careful because this will give you a frequency distribution for every variable in the dataset. With a small dataset, that may be no problem. If you have 13,000 people with a unique subject number for each of the 13,000 people in your dataset, you will get several hundred pages of output. To get frequencies only for specific variables, list the variables desired in a tables statement, as shown in the example below.

proc freq data = usage ;
tables computer internet email ;
run;

This will give you frequencies for only three variables in the "usage" dataset: computer, internet and email.

To obtain means, standard deviations, minimum, maximum and N for all of the numeric variables in a dataset, type the following:

proc means data= datasetname ;
run;

To get statistics only for specific variables from the means procedure, list the variables desired in a var statement, as shown in the example below.

proc means data = usage ;
var computer internet email ;
run;

The third very commonly used descriptive procedure is the Univariate procedure. This procedure provides means, standard deviations,mean, median, mode, test of the hypothesis that the population mean is zero, and tests of normality, including skewness and kurtosis. Graphs can also be requested, as shown in the example below:

Ods pdf file = "c:\am_sas\univariate_examp.pdf" ;
Title "Histogram of Age" ;
Title2 "With Normal Curve Overlay" ;
proc univariate data = in.er_sample ;
var age ;
histogram age/ normal ;
run;
ods pdf close ;
run;

An example of the output of an Univariate procedure is available here in .pdf format.

The frequency, means and univariate procedures are just three out of hundreds of SAS options for statistical analysis. The inferential statistics page provides a brief introduction to a few SAS procedures for inferential statistics. To learn more about SAS statistical analysis procedures and functions, check the Learn More about SAS: Recommended Sites & Resources page for recommended websites, books and articles.

Last updated:
February 24, 2010

SAS

The use of all USC computing resources is governed by the USC Computing Policies.