# Odds Ratio and Hazard Ratio - HELP!

#### lca223

##### New Member
I am trying to figure out how to calculate an estimated hazard ratio associated with a specific variable. I have the estimate and standard errors from SAS. I have a formula e^beta(Xa-Xb) for each individual. Just not sure what I should use for Xa and Xb. Also trying to calculate statistical significance.

I am also trying to figure out an estimated odds ratio related to a categorical variable (0,1,2). I want to the know the odds ratio for 1 and 2 while 0 is referent. Then to calculate statistical significance.

PLEASE HELP! #### marchhare

##### New Member
Are we talking about logistic regression / logit here?

If so the probability of a 1 on the DV is given by taking e to the power of the regression formula and dividing it by itself plus 1:

p(outcome) = [e^(B0 + B1(x1) + B2(x2) ... Bn(xn))] / [e^(B0 + B1(x1) + B2(x2) ... Bn(xn)) + 1]

Where B0 is the intercept coefficient, B1 is the coefficient for x1, etc. You plug in the individual's values for the predictors into this formula to get their probability of being a 1 on the DV. SAS should give you the t-test and p-value for each coefficient if you are using proc logistic.

The odds ratio for any one predictor is given by taking e to the power of that predictor's coefficient, e^(Bi). It's the same story for your categorical variable, but you will have to dummy code it with "0" as the reference level, meaning you will have two dummy variables, and two associated odds ratios. You have to dummy code (or have SAS do it for you, or effects code) your categorical variable, otherwise it will treat the categorical variable as if it is metric.

#### lca223

##### New Member
The first question is over a cox regression - not a logistic regression.

#### marchhare

##### New Member
Ohhhh... I don't have any experience with Cox regression, sorry! It would be a good idea to specify what analysis you are doing when asking a question, as odds ratios show up in several different procedures.

Good luck, sorry I couldn't help!

#### Mean Joe

##### TS Contributor
You're using PROC PHREG in SAS? I thought that gave you the Hazard Ratio estimate in one of the tables. It can also give you the upper/lower CI for the HR if you put the rl option in the model statement.

proc phreg;
model outcome = othervariables / rl;
run;

Declare your variable in the class statement, to get the estimates for 1 vs 0 and for 2 vs 0

proc logistic;
class level3variable(ref="0") / param=ref; *make sure you put the 0 in quotes, even if it is number type;
model outcome = level3variable othervariables;
run;