BookmarkSubscribeRSS Feed
Angmar
Obsidian | Level 7

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;

 

2 REPLIES 2
SAS_Rob
SAS Employee

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 

StatDave
SAS Super FREQ

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; 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 1252 views
  • 0 likes
  • 3 in conversation