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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 1443 views
  • 4 likes
  • 3 in conversation