BookmarkSubscribeRSS Feed
iuri_leite
Fluorite | Level 6

Dear ALL,

I am evaluating Differences in median values between three groups. 

I used the following code:

ODS GRAPHICS ON;
PROC NPAR1WAY DATA=TTT WILCOXON MEDIAN;
CLASS PAIS;
VAR CARGA_VIRAL_QUANT;
RUN;
ODS GRAPHICS OFF;
RUN;

the sas output showed me the p-value relative to the Kruskal Wallis test (p-value=0.21) and to the Mood's test (p-value=0.02).

It is not clear to me which one to use.

Best regards,

 

3 REPLIES 3
sbxkoenk
SAS Super FREQ

Hello ,

 

There is no option MOOD in your PROC NPAR1WAY statement. So you have not requested an analysis of Mood scores. Are you sure about having any output based on Mood scores?

 

You have requested an analysis of Wilcoxon scores (WILCOXON option).
When there are two classification levels (samples), this option produces the Wilcoxon rank-sum test. For any number of classification levels, this option produces the Kruskal-Wallis test. 

 

Mood's Median Test is particularly useful when there are significant outliers, as it is less sensitive to them than the Kruskal-Wallis test.

 

Good luck,

Koen

Ksharp
Super User

proc npar1way is only suited for TWO group , and have LOW power of model.

If you need to compare THREE groups, I suggested to use PROC QUANTREG.

Check  @Rick_SAS   blogs:

https://blogs.sas.com/content/iml/2017/02/22/difference-of-medians-sas.html

https://blogs.sas.com/content/iml/2020/06/03/difference-between-percentiles.html

https://blogs.sas.com/content/iml/2018/08/13/quantile-regression-chess-ratings.html

 


proc quantreg data=Sashelp.Heart(obs=1000);
   class bp_status;
   model weight = bp_status / quantile=0.5;
   estimate 'High VS Normal' bp_status 1 -1 0/ CL;
   estimate 'High VS Optimal' bp_status 1 0 -1/ CL;
   estimate 'Normal VS Optimal' bp_status 0 1 -1 / CL;

run;

Ksharp_0-1761620059626.png

 

 

Ksharp
Super User
By the way, if you have three groups , Kruskal Wallis test lead to the non-parameter version of ANOVA .

If you have two groups, you should check this:
Median Two-Sample Test
Statistic Z Pr > Z Pr > |Z|
1717.000 30.8702 <.0001 <.0001

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore Now →
What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1101 views
  • 0 likes
  • 3 in conversation