How do you perform an F-Test in SAS?

In SAS, an F-Test can be performed using the procedure PROC GLM. The procedure requires specifying the model in the MODEL statement and the NULL and ALTERNATIVE hypotheses in the TEST statement. The F-test results are reported in the output along with the F-value, degrees of freedom, and the corresponding p-value.


An F-test is used to test whether two population variances are equal.

The null and alternative for the test are as follows:

  • H0: σ12 = σ22 (the population variances are equal)
  • HA: σ12 ≠ σ22 (the population variances are not equal)

The F-test is typically used to answer one of the following questions:

1. Do two samples come from populations with equal variances?

2. Does a new treatment or process reduce the variability of some current treatment or process?

The easiest way to perform an F-test in SAS is to use the PROC TTEST statement, which is used for performing t-tests but also performs an F-test by default.

The following example shows how to perform an F-test in SAS in practice.

Example: F-Test in SAS

Suppose we have the following dataset in SAS that contains information about the points scored by various basketball players on two different teams:

/*create dataset*/
data my_data;
    input team $ points;
    datalines;
A 18
A 19
A 22
A 25
A 27
A 28
A 41
A 45
A 51
A 55
B 14
B 15
B 15
B 17
B 18
B 22
B 25
B 25
B 27
B 34
;
run;

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

Suppose we would like to perform an F-test to determine if the variance in points scored is equal between the two teams.

We can use the following syntax to do so:

/*perform F-test for equal variances*/
proc ttest data=my_data;
    class team;
    var points;
run;

The last table in the output titled Equality of Variances contains the F-test results.

  • The F-Test statistic is 4.39.
  • The corresponding p-value is 0.0383.

Since this p-value is less than .05, we reject the null hypothesis of the F-test.

This means we have sufficient evidence to say that the variance in points scored by the two teams is not equal.

Note: If you perform a two sample t-test to determine if the mean points values are equal between the two teams, you would use the p-value for the row called Satterthwaite in the output since you cannot assume that the population variances are equal between the two groups.

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

x