BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
TomHsiung
Pyrite | Level 9

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.

1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ
The most likely reason is that you specified serumALB in your MODEL statement as a predictor rather than the spline effect, splALB. Effectively, the spline was not even used in the model.

View solution in original post

6 REPLIES 6
StatDave
SAS Super FREQ

What you are trying to do is not entirely clear, but this note might address it. 

TomHsiung
Pyrite | Level 9

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

Screenshot 2023-08-31 at 6.40.14 PM.png

pink_poodle
Barite | Level 11

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.

StatDave
SAS Super FREQ
The most likely reason is that you specified serumALB in your MODEL statement as a predictor rather than the spline effect, splALB. Effectively, the spline was not even used in the model.
TomHsiung
Pyrite | Level 9
Exactly! This is the issue. I specified serumALB instead of SplALB in the MODEL statement. After correcting this error, everything followed as expected. Thank you.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1470 views
  • 3 likes
  • 4 in conversation