kruskal.test(Sepal_Width~Species, data=iris_sub)
Kruskal Wallis R v SAS
Kruskal-Wallis: R and SAS
From the individual R and SAS pages, performing the Kruskal-Wallis test in R using:
and in SAS using:
=iris_sub wilcoxon;
proc npar1way data
class Species;
var Sepal_Width;
exact; run;
produced the same results for the test statistic and asymptotic p-value.
There is a difference between languages in that SAS provides the EXACT option to easily output the exact p-value, where R does not seem to have an equivalent. A Monte Carlo permutation test may offer an alternative to the exact test on R. The coin
package could help in implementing this.