* wilcoxon.sas, example from SAS documentation; options ls=76 nodate; ; data React; input Stim Time @@; datalines; 1 1.94 1 1.94 1 2.92 1 2.92 1 2.92 1 2.92 1 3.27 1 3.27 1 3.27 1 3.27 1 3.70 1 3.70 1 3.74 2 3.27 2 3.27 2 3.27 2 3.70 2 3.70 2 3.74 ; proc npar1way wilcoxon correct=no data=React; class Stim; var Time; exact wilcoxon; title 'Illustration of Wilcoxon Rank Sum Test'; ; proc rank ties=mean out=rrank; var Time; ranks rank; title2 'Compute rank sum for stim=2'; data rrank; set rrank; rank = (rank)*(stim-1); * gives rank if stim=2, else zero; proc sort; by Time; proc print; proc means sum; var rank; Illustration of Wilcoxon Rank Sum Test 1 The NPAR1WAY Procedure Wilcoxon Scores (Rank Sums) for Variable Time Classified by Variable Stim Sum of Expected Std Dev Mean Stim N Scores Under H0 Under H0 Score -------------------------------------------------------------------- 1 13 110.50 130.0 11.004784 8.500 2 6 79.50 60.0 11.004784 13.250 Average scores were used for ties. Wilcoxon Two-Sample Test Statistic (S) 79.5000 Normal Approximation Z 1.7720 One-Sided Pr > Z 0.0382 Two-Sided Pr > |Z| 0.0764 t Approximation One-Sided Pr > Z 0.0467 Two-Sided Pr > |Z| 0.0933 Exact Test One-Sided Pr >= S 0.0527 Two-Sided Pr >= |S - Mean| 0.1054 Kruskal-Wallis Test Chi-Square 3.1398 DF 1 Pr > Chi-Square 0.0764 Illustration of Wilcoxon Rank Sum Test 2 Compute rank sum for stim=2 Obs Stim Time rank 1 1 1.94 0.0 2 1 1.94 0.0 3 1 2.92 0.0 4 1 2.92 0.0 5 1 2.92 0.0 6 1 2.92 0.0 7 1 3.27 0.0 8 1 3.27 0.0 9 1 3.27 0.0 10 1 3.27 0.0 11 2 3.27 10.0 12 2 3.27 10.0 13 2 3.27 10.0 14 1 3.70 0.0 15 1 3.70 0.0 16 2 3.70 15.5 17 2 3.70 15.5 18 1 3.74 0.0 19 2 3.74 18.5 Illustration of Wilcoxon Rank Sum Test 3 Compute rank sum for stim=2 The MEANS Procedure Analysis Variable : rank Rank for Variable Time Sum ------------ 79.5000000 ------------