I am trying to calculate odds ratios using the contrast statement in proc logistic. I have two independent variables, one is binary (variable1 = 0 or 1) and the other has 3 levels (variable2 = 0, 1, or 2). I've been looking over several examples for using the contrast statement, but it seems there is some flexibility in how one codes the contrast and this has me confused. My question is, how would one code contrasts for the following comparisons in proc logistic:
variable1 = 0, variable2 1 vs 0
variable1 = 0, variable2 2 vs 0
variable1 = 1, variable2 1 vs 0
variable1 = 1, variable2 2 vs 0
And lastly, for all observations (whether viarable1= 0 or 1)
variable2 1 vs 0
variable2 2 vs 0
Is it possible to do this last contrast or would I need to create an additional dummy variable?
EDIT:
Just to note, I somewhat understand the syntax for contrasts, I think it should look something like (but please correct me if I'm wrong):
But I don't understand how to do a contrast for 'variable2 1 vs 0' or 'variable2 2 vs 0' for all the data, not dichotomizing by variable1 as above. If anyone could offer any suggestions I'd really appreciate it.
variable1 = 0, variable2 1 vs 0
variable1 = 0, variable2 2 vs 0
variable1 = 1, variable2 1 vs 0
variable1 = 1, variable2 2 vs 0
And lastly, for all observations (whether viarable1= 0 or 1)
variable2 1 vs 0
variable2 2 vs 0
Is it possible to do this last contrast or would I need to create an additional dummy variable?
EDIT:
Just to note, I somewhat understand the syntax for contrasts, I think it should look something like (but please correct me if I'm wrong):
Code:
contrast 'variable1 = 0, variable2 1 vs 0' variable2 1 -1 /e estimate=exp;
contrast 'variable1 = 0, variable2 2 vs 0' variable2 2 1 /e estimate=exp;
contrast 'variable1 = 1, variable2 1 vs 0' variable1 1 variable2 1 -1 /e estimate=exp;
contrast 'variable1 = 1, variable2 2 vs 0' variable1 1 variable2 2 1 /e estimate=exp;