Hi, everyone
I spent a lot of time yesterday searching how to make spline for odd ratios after a logistic regression. My idea is simple the coefficient of a continuous variable is derived from the logistic regression, and I can use it and its CI to construct the spline for ORs.
But I did not find any direct SAS procedures or statements to do so. Would you guide me the direction? Thank you.
What you are trying to do is not entirely clear, but this note might address it.
Hello, Dave.
Wow! That's a great reference. Thanks. I copied and edited the code to suit my project. But, so far, I have never get the Odd Ratio plot as shown in the first example. My code only generated one column for the variable of serumAlb. I am just not able to make it. Your investigation would be of great important. Thanks.
My code:
%macro Logistic2;
proc logistic data= &raw_data_name plots = oddsratio(type=vertical);
class &class_var;
effect SplALB=spline(serumAlb/naturalcubic);
model &censor(event = '1') = &indep_list;
effectplot fit(x=serumAlb);
effectplot fit(x=serumAlb) / link;
oddsratio serumAlb / at(serumAlb=34.8125 36.0425 37.35 39.0 40.92);
store kmod;
run;
%mend;
%Logistic2
You got to work incrementally and get something basic to work before tailoring it to your cause. Try copying the syntax in the note exactly except for your variable and dataset. Will it work? If so, you can make little incremental changes, all the time saving the previous working codes for possible step back. For example, the values in the note had “to” syntax. Also, do not use macro language at early development stage. Everything should be unoriginal, clear and transparent.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.