6 C
London
Tuesday, March 11, 2025
HomeSASDescriptive Statistics in SASHow to Perform a Paired Samples t-Test in SAS

How to Perform a Paired Samples t-Test in SAS

Related stories

Learn About Opening an Automobile Repair Shop in India

Starting a car repair shop is quite a good...

Unlocking the Power: Embracing the Benefits of Tax-Free Investing

  Unlocking the Power: Embracing the Benefits of Tax-Free Investing For...

Income Splitting in Canada for 2023

  Income Splitting in Canada for 2023 The federal government’s expanded...

Can I Deduct Home Office Expenses on my Tax Return 2023?

Can I Deduct Home Office Expenses on my Tax...

Canadian Tax – Personal Tax Deadline 2022

  Canadian Tax – Personal Tax Deadline 2022 Resources and Tools...

A paired samples t-test is used to compare the means of two samples when each observation in one sample can be paired with an observation in the other sample.

This tutorial explains how to perform a paired samples t-test in SAS.

Example: Paired Samples t-Test in SAS

Suppose a professor wants to determine if a certain study program affects test scores. To test this, he randomly selects 15 students to take a pre-test. Then, he has each student use the study program for one month and then a post-test of similar difficulty.

The test scores for each of the 15 students are shown below:

To compare the difference between the mean scores on the pre-test and post-test, the professor can use a paired samples t-test because for each student their pre-test score can be paired with their post-test score.

Use the following steps to perform this paired samples t-test in SAS:

Step 1: Create the Data

First, let’s use the following code to create the dataset in SAS:

/*create dataset*/
data test_scores;
    input pre post;
    datalines;
88 91
82 84
84 88
93 90
75 79
78 80
84 88
87 90
95 90
91 96
83 88
89 89
77 81
68 74
91 92
;
run;

/*view dataset*/
proc print data=test_scores;

Step 2: Perform the Paired Samples t-test

Next, we can use proc ttest to perform the paired samples t-test:

/*perform paired samples t-test*/
proc ttest data=test_scores alpha=.05;
    paired pre*post;
run;

paired samples t-test in SAS

From the output we can see the following:

  • Mean difference between pre-test and post-test score: -2.3333
  • 95% Confidence Interval for Mean difference: [-4.0165, -.6502]

We can also see the t test statistic and corresponding two-sided p-value:

  • t test statistic: -2.97
  • p-value: .0101

In this example, the paired samples t-test uses the following null and alternative hypotheses:

  • H0The mean pre-test and post-test scores are equal
  • HA: The mean pre-test and post-test scores are not equal

Since the p-value (0.0101) is less than 0.05, we reject the null hypothesis.

This means we have sufficient evidence to say that the true mean test score is different for students before and after participating in the study program.

Additional Resources

The following tutorials explain how to perform other common statistical tests in SAS:

How to Perform a One Sample t-Test in SAS
How to Perform a Two Sample t-Test in SAS
How to Perform a Wilcoxon Signed Rank Test in SAS

Subscribe

- Never miss a story with notifications

- Gain full access to our premium content

- Browse free from up to 5 devices at once

Latest stories