Search code examples
statisticssaskolmogorov-smirnov

SAS - Kolmogorov-Smirnov Two Sided Critical Values


I am trying to compute the critical values for the two-sided Kolmogorov-Smirnov test (PROC NPAR1WAY doesn't output these!). This is calculated as c(a) * sqrt( (n+m)/(nm) ) where n and m are the number of observations in each dataset and c(a) = 1.36 for for confidence level a = 0.05.

Either,

A) is there a routine in SAS that will calculate these for me? (I've been searching a while) or,

B) what is the best way to compute the statistic myself? My initial approach is to select the number of rows from each data set into macro variables then compute the statistic, but this feel ugly.

Thanks in advance


Solution

  • A) Probably not, if you've searched all the relevant documentation.

    B) That method sounds fine, but you can use a data step if you prefer, e.g.

    data example1 example2;
        set sashelp.class;
        if _n_ < 6 then output example1;
        else output example2;
    run;
    
    data _null_;
        if 0 then set example1 nobs = n;
        if 0 then set example2 nobs = m;
        call symput('Kolmogorov_Smirnov_05',1.36 * sqrt((n+m)/(n*m)));
    run;
    
    %put &=Kolmogorov_Smirnov_05;