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.
I appreciate your timely help!
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;
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;
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;
BTW, I cannot attached the table due to HTML error....Try to find the table labelled as "Class Level Information".
use ODDSRATIO statement or
use
model old (event="1") = time/clodds=pl EXP ;
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.