BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Good Morning everyone,

I am new to SAS and have a question.

I have a dataset with one independent Group with 5 levels and one dependent variable Pol.


I am conducting a comparison of means using GLM with the following code:


proc glm data=mylib.'Sheet1$'n;
class Group;
model pol = Group;
lsmeans CDKstage / stderr;

The procedure works fine and shows a highly significant difference between the levels of Group p<.001. Now I would like to conduct a follow up analysis to determine which of the levels of group are different from the others. How do I do a post hoc comparison of means in Proc GLM.

Thank you!!
3 REPLIES 3
deleted_user
Not applicable
I believe I figure it out. I was able to conduct a Tukey pairwise comparison of means by simply adding a T to the lsmeans code as seen below. Because there have been a few views but no suggestion.maybe this will help others.


proc glm data=mylib.'Sheet1$'n;
class Group;
model pol = Group;
lsmeans CDKstage / T stderr;
Paige
Quartz | Level 8
The help for SAS 9.2 doesn't list T as an option in the LSMEANS statement.

It does list ADJUST=T as an option in the LSMEANS statement, which is NOT the TUKEY comparison of means. It is a simple t-test comparison of means.
statsplank
Calcite | Level 5
Hi Docnew,

Try the following:

proc glm data=mylib.'Sheet1$'n;
class Group;
model pol = Group;
lsmeans Group / pdiff adjust=tukey;
run;

SAS Innovate 2025: Register Now

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 10828 views
  • 0 likes
  • 3 in conversation