University of Southern California

ITS Information Technology Services

A division of the Office of the Chief Information Officer

Inferential Statistics Using SAS

With the number of procedures available and options within procedures, the possible statistical analyses with SAS easily number in the hundreds, perhaps thousands. Still, most users' needs to test for statistical significance fall into one of two groups; determining the difference between two or more means or determining the relationship between variables.

Testing for Statistically Significant Differences between Two Groups: T-Test

To test for the difference between two independent groups, an independent t-test would be used. The syntax is:

Proc ttest data = datasetname ;
class group;
var independent ;

The following example tests for the significance of difference in final exam score between two sections of Psychology 101, one taught in a standard lecture format and the other taught over the web using Blackboard and course web pages.

Proc ttest data = psych.methods ;
class section;
var final ;

To see the independent t-test procedure output, click here.

It is possible to request multiple t-tests by listing several variables in a var statement. However, for statistical reasons, this is NOT recommended.

Dependent t-tests are used when there is some relationship between the two variables. The most common use is when the same person is tested twice. To perform a paired, or dependent, t-test in SAS, use the following code :

Proc ttest data = datasetname ;
paired variable1 * variable2;

For example, Dr. Jones is interested in whether using the new Wii Fit video game as a form of exercise could reduce blood pressure. He records the blood pressure for 50 of his patients. Afte a month of using the Wii Fit daily, he takes a second reading. The code below tests for a difference in blood pressure between times one and two.

Proc ttest data = med.bp ;
paired bpre * bpost ;

What if more than two groups are being tested, e.g. three different methods of compensation; salary, salary plus commission and commission only? Testing for the differences among three or more groups is one of the many applications for Analysis of Variance.

Last updated:
September 24, 2008

SAS

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