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.
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.
%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.
SAS is headed back to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team.
Interested in speaking? Content from our attendees is one of the reasons that makes SAS Innovate such a special event!
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.