Wilcoxon-Mann-Whitney Test using SAS


Let’s use the mpg data file and create a new categorical variable according to exist variable drv. The new drv_front variable is defined as 1 if drv = ‘f’ or 0 if not equal ‘f’.  We wish to test whether the highway mpg (hwy) is the same for front-wheel drive car and other car (drv_front).

data mpg;
  set mpg;
  if drv = 'f' then drv_front = 1;
  else drv_front = 0;
proc npar1way data = mpg wilcoxon;
  class drv_front;
  var hwy;

SAS result wilcoxon rank sum test


The results suggest that there is a statistically significant difference between the underlying distributions of the highway mpg of front-wheel drive car and the mpg scores of other type cars (p < .0001).


See Also:

Do the same test in R

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *