Related Experiment Video
Updated: May 25, 2026

Flypub To Study Ethanol Induced Behavioral Disinhibition and Sensitization
Published on: May 18, 2020
A SAS macro for testing differences among three or more independent groups using Kruskal-Wallis and Nemenyi tests
Yuewei Liu1,2, Weihong Chen3
1Department of Occupational and Environmental Health, School of Public Health, Tongji Medical College, Huazhong University of Science and Technology, Wuhan, 430030, China.
Abstract:
As a nonparametric method, the Kruskal-Wallis test is widely used to compare three or more independent groups when an ordinal or interval level of data is available, especially when the assumptions of analysis of variance (ANOVA) are not met. If the Kruskal-Wallis statistic is statistically significant, Nemenyi test is an alternative method for further pairwise multiple comparisons to locate the source of significance. Unfortunately, most popular statistical packages do not integrate the Nemenyi test, which is not easy to be calculated by hand. We described the theory and applications of the Kruskal-Wallis and Nemenyi tests, and presented a flexible SAS macro to implement the two tests. The SAS macro was demonstrated by two examples from our cohort study in occupational epidemiology. It provides a useful tool for SAS users to test the differences among three or more independent groups using a nonparametric method.
Related Concept Videos
Kruskal-Wallis Test
One-Way ANOVA: Unequal Sample Sizes
Comparing the Survival Analysis of Two or More Groups
One-Way ANOVA
One-Way ANOVA: Equal Sample Sizes
Different sample means can result in different values for the variance estimate: variance between samples. This is because the variance between samples is calculated as the product of the sample size and the variance between the...
McNemar's Test
