Hello.
I need to calculate Wilcoxon Mann-Whitney Odds with 95% CI (WMWodds). I have found a website describing have to do these calculations, but the attached macro is no longer available (see https://support.sas.com/resources/papers/proceedings/proceedings/sugi31/209-31.pdf). Does anyone know, if WMWodds is built into SAS, or where i can download a macro?
I'm using SAS 9.4.
Best regards
Joachim
I searched and found this. Does this help?
%macro WMWodds (_DATASET, _GROUP, _Y);
ods listing close;
proc npar1way data = &_dataset. Correct = no;
class &_GROUP.;
Var &_Y .;
ods output WilcoxonScores = WS (keep = Class SumOfScores);
run;
proc transpose data = ws out = flag prefix = wscore_;
var SumOfScores;
id CLASS;
run;
data _NULL_;
set FLAG;
if (WSCORE_1> = WSCORE_2) then
call symput ("_flag", 1);
else call symput ("_flag", 2);
run;
proc logistic data = &_dataset .;
class &_GROUP.;
Model &_GROUP. = &_Y .;
roc;
ods output ROCAssociation = AUROC;
run;
ods listing;
data WMWODDS;
set AUROC;
if (&_FLAG = 1) then
do WMWOdds = Area / (1-Area);
SE = StdErr / (1-Area) ** 2;
LnWMW = log (area / (1-area));
LnSE = StdErr / (Area * (1-Area))
end;
else
do;
WMWOdds = (1-Area) / Area;
SE = StdErr / Area ** 2;
LnWMW = log ((1-area) / area);
LnSE = StdErr / (Area * (1-Area)) );
end;
z = quantile ("normal", 0.975);
LowerCI = WMWOdds --z * se;
UpperCI = WMWOdds + z * se;
LowerCI_exp = exp (LnWMW --z * lnse);
UpperCI_exp = exp (LnWMW + z * lnse) if _n_ = 1;
keep Area StdErr WMWOdds SE LowerCI UpperCI LowerCI_exp UpperCI_exp;
run;
title "&_DATASET.";
proc print noobs;
run;
%mend;
I searched and found this. Does this help?
%macro WMWodds (_DATASET, _GROUP, _Y);
ods listing close;
proc npar1way data = &_dataset. Correct = no;
class &_GROUP.;
Var &_Y .;
ods output WilcoxonScores = WS (keep = Class SumOfScores);
run;
proc transpose data = ws out = flag prefix = wscore_;
var SumOfScores;
id CLASS;
run;
data _NULL_;
set FLAG;
if (WSCORE_1> = WSCORE_2) then
call symput ("_flag", 1);
else call symput ("_flag", 2);
run;
proc logistic data = &_dataset .;
class &_GROUP.;
Model &_GROUP. = &_Y .;
roc;
ods output ROCAssociation = AUROC;
run;
ods listing;
data WMWODDS;
set AUROC;
if (&_FLAG = 1) then
do WMWOdds = Area / (1-Area);
SE = StdErr / (1-Area) ** 2;
LnWMW = log (area / (1-area));
LnSE = StdErr / (Area * (1-Area))
end;
else
do;
WMWOdds = (1-Area) / Area;
SE = StdErr / Area ** 2;
LnWMW = log ((1-area) / area);
LnSE = StdErr / (Area * (1-Area)) );
end;
z = quantile ("normal", 0.975);
LowerCI = WMWOdds --z * se;
UpperCI = WMWOdds + z * se;
LowerCI_exp = exp (LnWMW --z * lnse);
UpperCI_exp = exp (LnWMW + z * lnse) if _n_ = 1;
keep Area StdErr WMWOdds SE LowerCI UpperCI LowerCI_exp UpperCI_exp;
run;
title "&_DATASET.";
proc print noobs;
run;
%mend;
Sorry for the late reply!
Yes for now it seems to work.
Thanks!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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 lock in 2025 pricing—just $495!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.