BookmarkSubscribeRSS Feed
Kastchei
Pyrite | Level 9
All:

I need to report the Mann-Whitney U Statistic. Is there a way to get SAS to produce this value via a procedure? If not, is there a way to calculate the U statistic from the Wilcoxon statistics PROC NPAR1WAY provides?

Note: From what I understand, the p-values of the Mann-Whitney and Wilcoxon tests are identical, but I cannot report a Wilcoxon statistic; I must report the U statistic.

Thank you.
2 REPLIES 2
deleted_user
Not applicable
I guess it's not a direct output of NPAIR1WAY. Manual calculation is desired. For example,
/*
data wilcox;
infile datalines missover;
input type $ x @;
do while (x ne .);
output;
input x @;
end;
input;
datalines;
sunlight 6.0 4.8 5.1 5.5 4.1 5.3 4.5 5.1
shade 6.5 5.5 6.3 7.2 6.8 5.5 5.9 5.5
;
run;
ods output WilcoxonScores=yyy;
ods listing close;

proc npar1way wilcoxon data=wilcox;
class type;
var x;
exact;
run;
data _null_;
array n[2] _temporary_;
array R[2] _temporary_;
array U[2] _temporary_;
do _n_=1 by 1 until(eof);
set yyy(rename=(N=_N)) end=eof;
n[_n_] = _n;
R[_n_] = SumOfScores;
end;
U[1] = n[1]*n[2] + n[1]*(n[1]+1)/2 - R[1];
U[2] = n[1]*n[2] + n[2]*(n[2]+1)/2 - R[2];
put U[1]= U[2]=;
run;
*/
of course you can do it in IML.

Reference:
http://en.wikipedia.org/wiki/Mann-Whitney_U
http://www.saburchill.com/IBbiology/stats/002.html
LarsDiaz
Calcite | Level 5

The HTML seems to have wreaked a little bit of havoc on an otherwise very illuminating and much appreciated answer 🙂 thanks

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!

Register now

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 3129 views
  • 1 like
  • 3 in conversation