How to Perform a Kolmogorov-Smirnov Test in SAS


The Kolmogorov-Smirnov test is used to determine whether or not or not a sample is normally distributed.

This test is widely used because many statistical tests and procedures make the assumption that the data is normally distributed.

The following step-by-step example shows how to perform a Kolmogorov-Smirnov test on a sample dataset in SAS.

Example: Kolmogorov-Smirnov Test in SAS

First, let’s create a dataset in SAS with a sample size of n = 20:

/*create dataset*/
data my_data;
    input Values;
    datalines;
5.57
8.32
8.35
8.74
8.75
9.38
9.91
9.96
10.36
10.65
10.77
10.97
11.15
11.18
11.47
11.64
11.88
12.24
13.02
13.19
;
run;

Next, we’ll use proc univariate to perform a Kolmogorov-Smirnov test to determine if the sample is normally distributed:

/*perform Kolmogorov-Smirnov test*/
proc univariate data=my_data;
   histogram Values / normal(mu=est sigma=est);
run;

At the bottom of the output we can see the test statistic and corresponding p-value of the Kolmogorov-Smirnov test:

Kolmogorov-Smirnov test in SAS

The test statistic is 0.1098 and the corresponding p-value is >0.150.

Recall that a Kolmogorov-Smirnov test uses the following null and alternative hypotheses:

  • H0: The data is normally distributed.
  • HA: The data is not normally distributed.

Since the p-value from the test is not less than .05, we fail to reject the null hypothesis.

This means we can assume that the dataset is normally distributed.

Additional Resources

The following tutorials explain how to perform a Kolmogorov-Smirnov test in other statistical software:

How to Perform a Kolmogorov-Smirnov Test in Excel
How to Perform a Kolmogorov-Smirnov Test in R
How to Perform a Kolmogorov-Smirnov Test in Python

Leave a Reply

Your email address will not be published.