BookmarkSubscribeRSS Feed
jmbmpm
Calcite | Level 5

I am trying to analyze a dataset that has two dichotomous variables (placstat and hiv) predicting a continuous variable (lplacwbc). The data are unbalanced. I am interested in seeing a matrix for pairwise comparisons, with p values, for all possible comparisons. The following code yields the output provided (not showing the model output, only lsmeans output). I may be missing something simple here, but I cannot figure it out!

 

proc glm;
class placstat hiv;
model lplacwbc=placstat hiv placstat*hiv/ ss1 ss2 ss3 ss4;
lsmeans placstat hiv/pdiff=all adjust=tukey;
run;

 

jmbmpm_0-1715467172359.png

 

 

2 REPLIES 2
dpalmer1
Fluorite | Level 6

To add the pairwise comparisons and p-values for the interaction term, change your LSMEANS statement to this:

lsmeans placstat hiv placstat * hiv / pdiff=all adjust=tukey;
jmbmpm
Calcite | Level 5
Perfect. So simple and it eluded me! Thanks!

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 601 views
  • 0 likes
  • 2 in conversation