# Reference coding in SAS Proc Logistics

#### noetsi

##### Loves R
I am doing reference coding and this confuses me. All my variables are dummy variables coded 1 and 0.

This is the code
PROC LOGISTIC DATA=WORK.SORTTempTableSorted
PLOTS(ONLY)=ALL
;
CLASS pd2 (PARAM=REF) pd1 (PARAM=REF) pd3 .....;
MODEL DVD (Event = '1')=pd1 pd2 pd3 pd4 pd5 pd6 pd7 pd8 pd9 pd10 pd11 pd12 pd13 pd15 pd16 pd17 pd18 pd19 pd20 pd21 pd22 pd23 pd24 pd25 pd26 pd27 pd28 pd29 pd30 pd31 pd14 /
SELECTION=NONE
;
RUN;
QUIT;

For the odds ratio the results are

So 1 has a greater impact on the DV taking on a value of 1. I am just not sure what 1 means here. Is is the way I coded it in my raw data or did sas change this by creating new design variables?

It says this, Is this effectively reversing the way I code the variables in the raw data?

#### hlsmith

##### Less is more. Stay pure. Stay poor.
The odds of the outcome equaling 1 for subjects with pd1 = 0 are 0.65 times the odds of subjects with pd1 = 1.

If you don't like this, make CLASS pd2 (PARAM=REF) pd1 (PARAM=REF) pd3 .....,/ ref='0'; Right?

#### noetsi

##### Loves R
I knew how to interpret it. I did not know how the 0 in the results corresponded to what is 0 in my raw data. That is, is sas leaving my 0 in the data as 0 or changing it to 1 when it builds variables.

If I do this /ref='0' the reference level will be what is 0 in my raw data right? So if 0 is male in the raw data using your example

The odds of the outcome equaling 1 for subjects with pd1 = male are 0.65 times the odds of subjects with pd1 = female.

#### noetsi

##### Loves R
I get an error message when I do that hlsmith. I am looking for the right way to set the reference to 0. It does not like the ref='0'

#### noetsi

##### Loves R
This should work, but does not.

Code:
PROC LOGISTIC DATA=WORK.SORTTempTableSorted
PLOTS(ONLY)=ALL
;
CLASS pd2     (REF='0') pd1     (REF='0') / param=ref;
MODEL DVD (Event = '1')=pd1 pd2
SELECTION=NONE
;
RUN;
QUIT;

#### hlsmith

##### Less is more. Stay pure. Stay poor.
If I can't figure out the coding scheme or estimates in a model - I simply it down to one IV and run it via the logistic and as a frequency table and compare the output as a quality check. Have you done anything like this?

#### noetsi

##### Loves R
If I can't figure out the coding scheme or estimates in a model - I simply it down to one IV and run it via the logistic and as a frequency table and compare the output as a quality check. Have you done anything like this?
I am not sure what that means. I figured out the error, although it baffles me.

Code:
PROC LOGISTIC DATA=WORK.SORTTempTableSorted
PLOTS(ONLY)=ALL
;
CLASS pd2     (REF='0') pd1     (REF='0')/ param=ref;
MODEL DVD (Event = '1')=pd1 pd2
/*SELECTION=NONE
;
RUN;
QUIT;
Runs fine. I don't understand why that default coding I commented out matters. But it messes up the code.

#### noetsi

##### Loves R
I found out the problem. I left out a / between the model statement and what I commented out. D'oh

#### hlsmith

##### Less is more. Stay pure. Stay poor.
What I meant was I will run a simple logistic model and proc freq / odds ratio and confirm they are kicking out similar results if I have a reference group concern.