I am just wondering if there is a mistake with the attached code since the class level information for sex is female = 0 and male = 1, the first part of the code is contrasting different groups in males and the value used was zero. Should it not be 1 instead?. Can some explain how the contrast statement works in an interaction?
If you want to make simple pairwise comparisons, it is always easiest to use the LSMEANS, LSMESTIMATE, or SLICE statement since this allows you to avoid the always error-prone process of determining contrast coefficients for the CONTRAST or ESTIMATE statement. This is discussed and illustrated in detail in this note. For a model with interaction, you can use the SLICE statement to simplify getting your comparisons.
Hi all,
I am testing an interaction between two categorical variables; the first variable has 5 levels and the other has 4. However, I just want to contrast some levels of this interaction and obtain an overall p-value for those interaction terms being contrasted. Is that possible? if so how?
Any help would be appreciated.
The note I referred to shows exactly the sort of comparisons you seem to want in your original post. Please look over the examples. The SLICE, LSMEANS, and LSMESTIMATE statements work the same way in any modeling procedure that supports them.
slice group*sex / sliceby=sex;
and
slice group*sex / sliceby=group;
Note that you need to use PARAM=GLM (not REF) in the CLASS statement to use SLICE, LSMEANS, or LSMESTIMATE. See the documentation of the SLICE and LSMEANS statements in your modeling procedure to see the additional options that are available.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.