I have written C++ code to calculate the exact Jonckheere Terpstra distribution (and therefore p-value) by enumerating all the possible combinations. I've found that PROC FREQ in SAS has option JT and exact which calculate the same p-value.
As a relative newcomer to SAS, I was wondering if anyone could offer insight into how SAS typically calculates these exact distributions. The reason I am so interested is because SAS's code runs a few orders of magnitude faster than my C++ code, after I've made some attempts to optimize it.