# How to Perform t-Tests in SAS

Nikki Kamouneh

Posted on
central limit theorem t test SAS t distribution

All three types of $$t$$-tests can be performed in SAS. This tutorial will demonstrate the steps and syntax needed to conduct one sample, two independent samples, and paired samples t-tests.

There are two datafiles used in this tutorial. The iq_wide can be downloaded from our GitHub repository here, and the iq_long data can be downloaded from our GitHub repository here. The one-sample and independent samples examples will use the iq_long data, and the paired samples example will use iq_wide.

## One Sample $$t$$-Test

Say we have data from 200 subjects who have taken an IQ test. We know in the general population the mean IQ is 100. We want to test the hypothesis that our sample comes from a different population, e.g. one that is more gifted than the general population. We will first look at the distribution of scores to determine if there are any outliers or if the distribution is highly skewed. Then we will test the null hypothesis that our sample comes from a population where $$\mu \ne 100$$.

To get the histogram we will run:

proc univariate data=iq_long noprint;
histogram iq;
run; 

This will give us the following figure: