Perform a Kolmogorov-Smirnov Test in SAS?

The Kolmogorov-Smirnov Test in SAS is a statistical test used to compare two data sets to determine if they come from the same underlying distribution. It is typically used to assess the normality of data distribution. The test works by comparing the cumulative distribution functions of the two data sets and then calculating the maximum difference between them. The smaller the difference, the more likely it is that the two data sets come from the same underlying distribution. In SAS, the PROC NPAR1WAY command is used to perform the Kolmogorov-Smirnov Test.


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

This test is widely used because many statistical tests and procedures make the 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.

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

x