*52*

A repeated measures ANOVA is used to determine whether or not there is a statistically significant difference between the means of three or more groups in which the same subjects show up in each group.

This tutorial provides a step-by-step example of how to perform a repeated measures ANOVA in SAS.

**Step 1: Create the Data**

Suppose a researcher want to know if four different drugs lead to different reaction times. To test this, he measures the reaction time of five patients on the four different drugs.

The reaction times are shown below:

We can use the following code to create this dataset in SAS:

**/*create dataset*/
data my_data;
input Subject Drug Value;
datalines;
1 1 30
1 2 28
1 3 16
1 4 34
2 1 14
2 2 18
2 3 10
2 4 22
3 1 24
3 2 20
3 3 18
3 4 30
4 1 38
4 2 34
4 3 20
4 4 44
5 1 26
5 2 28
5 3 14
5 4 30
;
run;
**

**Step 2: Perform the Repeated Measures ANOVA**

Next, weâ€™ll use **proc glm **to perform the repeated measures ANOVA:

**/*perform repeated measures ANOVA*/
proc glm data=my_data;
class Subject Drug;
model Value = Subject Drug;
run;**

**Step 3: Interpret the Results**

We can analyze the ANOVA table in the output:

The only value weâ€™re interested in is the F value and corresponding p-value for Drug since we want to know if the four different drugs lead to different reaction times.

From the output we can see:

- The F Value for Drug:
**24.76** - The p-value for Drug:
**<.0001>**

Recall that a repeated measures ANOVA uses the following null and alternative hypotheses:

**H**All group means are equal._{0}:**H**At least one group mean is different_{A}:_{Â }from the rest.

Since the p-value for Drug (<.0001 is less than .05 we reject the null hypothesis.>

This means we have sufficient evidence to say that the mean response time is not equal among the four different drugs.

**Additional Resources**

The following tutorials provide additional information about repeated measures ANOVAs:

Introduction to the Repeated Measures ANOVA

How to Perform a Repeated Measures ANOVA By Hand

One-Way ANOVA vs. Repeated Measures ANOVA: The Difference