Programming the statistical procedures from SAS

help in using contrast statements for exploring interactions

Reply
Occasional Contributor
Posts: 12

help in using contrast statements for exploring interactions

Hi,

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;

run;

 

SAS Employee
Posts: 97

Re: help in using contrast statements for exploring interactions

If age is a categorical variable then it would need to appear on the CLASS statement as well.

You might refer to this example

http://go.documentation.sas.com/?docsetId=statug&docsetVersion=14.3&docsetTarget=statug_logistic_exa...

 

And this usage note on CONTRASTs

http://support.sas.com/kb/24/447.html#ex3 

SAS Employee
Posts: 386

Re: help in using contrast statements for exploring interactions

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; 

Ask a Question
Discussion stats
  • 2 replies
  • 102 views
  • 0 likes
  • 3 in conversation