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;
Do you get something similar to this?
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 ;
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.
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).
Thanks! This does not give the p-value for each comparison though? Is there a way to get each p-value?
The p-value is the bottom number in each cell of the table.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.