BookmarkSubscribeRSS Feed
mmjohnson
Calcite | Level 5

I am new at working with contrasts. I was interested in resources to learn how to create contrasts. 

 

Also, I need help with one of my analyses - I have 3 factors: a (high and low), b (red and white), c (small, medium, large). I need to create contrasts for the main effect of the three level factor to compare small vs. medium, small vs. large and medium vs. small and also two-way interactions between factors. How would those contrasts look like, I am getting hung up on it. 

 

proc glimmix data=test;
class a b c;
model outcome=a b c a*b a*c b*c / dist=normal;
lsmeans a b c;

lsmeans a*b a*c b*c;

contrast .....

 

Thanks,

M

2 REPLIES 2
Reeza
Super User

@mmjohnson wrote:

I am new at working with contrasts. I was interested in resources to learn how to create contrasts. 

 

 

Thanks,

M


Here's a good resource: 

https://support.sas.com/resources/papers/proceedings11/351-2011.pdf

 

 

StatDave
SAS Super FREQ

You don't generally need CONTRAST statements for pairwise comparisons of effect levels and it is safer to avoid it when possible. Simply add the DIFF option in your LSMEANS statement. This note discusses the use of statements like LSMEANS, LSMESTIMATE, and SLICE for most comparisons since you don't have to work out the contrast coefficients when using these statements. But it also goes into detail on using CONTRAST and ESTIMATE statements for more general testing and estimation in which these statements might be needed.

 

This statement produces the pairwise comparisons among your C levels:

 

lsmeans c / diff;

 

See the options available in the LSMEANS statement which might be of use, such as the OM= and BYLEVEL options when dealing with unbalanced data.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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