06-12-2018 09:14 AM
I need to explore some interactions in my dataset, but I don't understand the code I was provided with (below). In my case, I have 5 age categories (under 12, 12-29, 30-64, 65-79, and 80 and older), and the exposure (COPD) and outcome (neurological disease) are both binary (0,1). How would I code this? Do I need to make a dummy variable for each age category? I'd really appreciate any help.
proc logistic data=arcus;
class arcus (ref="0") / param=ref;
model chd69 (event="1")=age50|arcus;
contrast 'arcus vs. no for age<50' arcus 1 age50*arcus 0 / estimate=both;
contrast 'arcus vs. no for age>=50' arcus 1 age50*arcus 1 / estimate=both;
contrast 'age50 vs. no with arcus' age50 1 age50*arcus 0 / estimate=both;
contrast 'age50 vs. no without arcus' age50 1 age50*arcus 1 / estimate=both;
contrast 'arcus and age50 vs. neither' age50 1 arcus 1 age50*arcus 1 / estimate=both;
06-12-2018 10:14 AM
If age is a categorical variable then it would need to appear on the CLASS statement as well.
You might refer to this example
And this usage note on CONTRASTs
06-12-2018 03:21 PM
In most cases, you can avoid the need to properly determine CONTRAST coefficients by using the LSMEANS, SLICE, or LSMESTIMATE statement. In the case of an interaction of two categorical predictors, the SLICE statement is best. Your description doesn't seem to match the code you show which suggests there are two binary predictors, age50 and arcus. For that code you can use a SLICE statement like the following to compare the age50 levels within each arcus level. A similar statement could compare arcus levels within arge50 levels. Note that GLM parameterization must be used for the above statements.
class age50 arcus / param=glm;
slice age50*arcus / sliceby=arcus means ilink cl;