BookmarkSubscribeRSS Feed
tka726
Obsidian | Level 7

Is there an option in LSMEANS of PROC GLM which will compute pairwise p-values?

In my program, the variable 'surgery' has 15 categories. I want to see pairwise differences & p-values between them all. I am trying to avoid writing many estimate statements.

 

proc glm data=ads;
  class surgery ;
  model event=surgery/solution ss3;;
  lsmeans surgery / cl adjust=tukey stderr pdiff tdiff ;
means surgery / tukey alpha=0.05 cldiff;

 

I can get the differences but not the p-values I want.

I'm trying to see if I can get the p-value from such an estimate statement, without typing out each comparison. I'm interested in the p-value from each comparison, not accounting for others.


estimate 'surgery 1 vs 2' surgery 1  -1 0 0 0 0 0 0 0 0 0 0 0 0 0 ;
estimate 'surgery 2 vs 1' surgery -1  1 0 0 0 0 0 0 0 0 0 0 0 0 0 ;

 

run;
quit;

6 REPLIES 6
data_null__
Jade | Level 19

Do you get something similar to this?

 

Capture.PNG

tka726
Obsidian | Level 7

I do, but why do these p-values not match what I get if I write out contrast statments?

I.e. these are the comparison p-values I want.

 

estimate 'surgery 1 vs 2' surgery 1  -1 0 0 0 0 0 0 0 0 0 0 0 0 0 ;
estimate 'surgery 2 vs 1' surgery -1  1 0 0 0 0 0 0 0 0 0 0 0 0 0 ;

PaigeMiller
Diamond | Level 26

They don't match because the LSMEANS comparisons uses Tukey adjustments to the p-values (that's what your code asked for), but your estimate statements have no such adjustment.

--
Paige Miller
sld
Rhodochrosite | Level 12 sld
Rhodochrosite | Level 12

If you do not want to adjust for experiment-wise Type I error, then remove "adjust=tukey" from the LSMEANS statement (while keeping in mind that there are 105 pairwise comparisons among 15 means, and only 14 degrees of freedom).

 

tka726
Obsidian | Level 7

Thanks! This does not give the p-value for each comparison though? Is there a way to get each p-value?

PaigeMiller
Diamond | Level 26

The p-value is the bottom number in each cell of the table.

--
Paige Miller

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 6 replies
  • 1988 views
  • 2 likes
  • 4 in conversation