turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- View implementation of the NPAR1WAY procedure

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-26-2015 05:47 AM

Hello,

I have implemented a two-sample Kolmogorov-Smirnov test in a language other than SAS. However, I need to compare my results with a set of results originating from the NPAR1WAY procedure in SAS. I have installed the SAS University Edition, thinking that one could view the source code of a procedure by typing some command (similar to R and MATLAB), but I have not found how to do so.

The following documentation describes the theoretical equations for the KS-test in SAS.

However, I would like to see the exact implementation of these equations. The approximation of the p-value can differ a lot, and while I don't care about which one is the most correct, I need to know the SAS implementation of it.

It seems like SAS calculates the complementary distribution instead of the actual distribution. When I do this in my code, the result is way off, while if I remove the (1 -) to calculate the actual distribution, the result is more reasonable.

So, to the question, how can I see the actual implementation of the Kolmogorov-Smirnov test in SAS?

Thanks,

Caroline

Accepted Solutions

Solution

02-27-2015
11:34 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to CarolineW

02-27-2015 11:34 AM

Short answer: You cannot see the code.

Long answer: You cannot see the code because it is proprietary. However, you can see the methodology and any formulas via the link you supplied. Given the fairly long history of NPAR1WAY and its implementation, I would check to see if anyone else has written a macro using DATA step or IML code to calculate KS. The archives at lexjansen.com would be good starting place.

Steve Denham

All Replies

Solution

02-27-2015
11:34 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to CarolineW

02-27-2015 11:34 AM

Short answer: You cannot see the code.

Long answer: You cannot see the code because it is proprietary. However, you can see the methodology and any formulas via the link you supplied. Given the fairly long history of NPAR1WAY and its implementation, I would check to see if anyone else has written a macro using DATA step or IML code to calculate KS. The archives at lexjansen.com would be good starting place.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SteveDenham

02-27-2015 04:08 PM

Thank you for your answer!

I suspected that it could be something along those lines, but since MATLAB shares their code for built-in functions I thought that SAS might also have done so.

I am not very familiar with SAS and realized that I was looking at old documentation (I think). The documentation for SAS/STAT 9.22 (link provided in the first post) gives an incorrect equation for the procedure (or it could be that the text is just misleading). The equation was changed from this complimentary distribution to the actual distribution in the documentation for SAS/STAT 13.2. See link below.

I have also implemented this later version of the equation and get the exact same result as SAS, indicating that this is the actual formula implemented in the SAS procedure.

Once again, thank you very much for your answer. This saved me a lot of time googling for code that does not exist.