Solved
Contributor
Posts: 40

# ODDS ratio- with reference level

Hi, I need to calculate odds ratios, while keeping  this group of time variable as referance -(6 months to less than 12 months).

I am new to this, please check the below code and I want to make sure I am doing this correctly.

Thank you.

proc format;
value timef 1='6 months to less than 12 months '
2='12 months to less than 24 months '
3='24 months to less than 36 months '
4='36 months and above';

value \$oldf '0'='Young'
'1'='Old'
;
run;

data one;
input old \$1. time;
datalines;
1 1
0 2
1 3
1 2
0 1
1 3
0 2
1 3
0 4
1 4
0 3
1 4
;
run;

data two;
set one;
format time timef.;
run;

ods graphics on;
proc logistic data=two plots(only)=(effect (clband) oddsratio (type=horizontalstat));
class time(param=ref ref="6 months to less than 12 months");
model old (event="1") = time/clodds=pl;
run;
ods graphics off;

Accepted Solutions
Solution
‎04-19-2017 12:56 PM
Occasional Contributor
Posts: 9

## Re: ODDS ratio- with reference level

The way you put referece level looks correct to me. I tested your code. You can find a table "Class Level Information" from the output (see below). The "0-0-0" in "Design Variables" represents the reference group, which is what you specified.

Be careful about your formats. Better to remove those blanks from format. Sometime, this can cause unexpected problem and can be hard to debug.

Proc Format;

Value timef

1='6 months to less than 12 months '
2='12 months to less than 24 months '
3='24 months to less than 36 months '
4='36 months and above'

;

Value \$oldf

'0'='Young'
'1'='Old'
;

run;

All Replies
Solution
‎04-19-2017 12:56 PM
Occasional Contributor
Posts: 9

## Re: ODDS ratio- with reference level

The way you put referece level looks correct to me. I tested your code. You can find a table "Class Level Information" from the output (see below). The "0-0-0" in "Design Variables" represents the reference group, which is what you specified.

Be careful about your formats. Better to remove those blanks from format. Sometime, this can cause unexpected problem and can be hard to debug.

Proc Format;

Value timef

1='6 months to less than 12 months '
2='12 months to less than 24 months '
3='24 months to less than 36 months '
4='36 months and above'

;

Value \$oldf

'0'='Young'
'1'='Old'
;

run;

Occasional Contributor
Posts: 9

## Re: ODDS ratio- with reference level

BTW, I cannot attached the table due to HTML error....Try to find the table labelled as "Class Level Information".

Super User
Posts: 10,787

## Re: ODDS ratio- with reference level

use ODDSRATIO statement or

use

model old (event="1") = time/clodds=pl  EXP ;

☑ This topic is solved.

Discussion stats
• 3 replies
• 215 views
• 0 likes
• 3 in conversation