Code
/* Exact Wilcoxon Rank-Sum Test (with Hodges-Lehmann CI) */
/* Best for small samples. Computationally intensive for large samples. */
proc npar1way data = dataset wilcoxon;
class explanatory;
var response;
exact HL wilcoxon;
run;
/* For one-sided alpha = 0.05, specify alpha = 0.10 to match CI to one-sided test */
/* HL = Hodges-Lehmann estimator of the median difference for confidence intervals. */
proc npar1way data = dataset wilcoxon alpha = 0.10;
class explanatory;
var response;
exact HL wilcoxon;
run;
/* Rank-Sum Test: NORMAL Approximation
the larger the sample size, you can use the z approximation
the smaller, the more conservative, choose the t approximation */
/* Normal approximation for large samples */
/* z-approximation used when sample size is large. Choose t-approximation for smaller samples or to be more conservative. */
proc npar1way data = dataset wilcoxon;
class explanatory;
var response;
run;
/* CI using normal approximation with HL estimator (asymptotic CI version) */
/* To get the CI to match a one-sided alpha = 0.5, set alpha = 0.1 */
proc npar1way data = dataset wilcoxon HL alpha = 0.10;
class explanatory;
var response;
run;
/* One-sided critical value from normal (Z) distribution */
data critval;
cv = quantile("normal", 0.95); alpha for left, 1-alpha for right;
run;
proc print data = critval;
run;