I'm using the spline function from the effect statement in PROC Logistic and noticed that the RCS transformations for my independent variable happen to be the same regardless of what outcome I use. This confused me as I thought the transformations were performed in relation to the outcome.
To illustrate my issue, I have fitted Death Status or BP Status against Weight as the independent variable. The data set used is the heart data set from sashelp. I'm running SAS9.4 M4.
Proc print and Proc Corr results below showing how the spline transformations are exactly the same. Proc freq results also below to show that the outcomes fitted are different.
data heart_anal;set sashelp.heart;
where BP_Status ne '' and weight ne . and status ne '';run;
proc logistic data=heart_anal noprint outdesign=cubic_out1;
effect spl=spline(Weight /basis=tpf(noint) naturalcubic knotmethod=rangefractions(0.10 0.50 0.90));
model Status= spl/expb;
run;
data cubic_out1;set cubic_out1;id=_n_;keep id spl1 spl2;run;
proc logistic data=heart_anal noprint outdesign=cubic_out2;
effect spl=spline(Weight /basis=tpf(noint) naturalcubic knotmethod=rangefractions(0.10 0.50 0.90));
model BP_Status= spl/expb;
run;
data cubic_out2;set cubic_out2;id=_n_;keep id spl1 spl2;rename spl1=spl1_2 spl2=spl2_2;run;
data comb;merge cubic_out1 cubic_out2;by id;run;
proc corr data=comb;var spl1 spl1_2 spl2 spl2_2;run;
proc print data=comb(obs=5);id id;var spl1 spl1_2 spl2 spl2_2;run;
proc freq data=heart_anal;table status*bp_status;run;
Thanks for reading. Any help will be greatly appreciated!
No, your assumption is not correct. Only the X variable is used to generate the spline effects. Notice that the EFFECT statement only refers to the WEIGHT variable in your example.
Here is the documentation for the spline effects, in case you want to read more details.
No, your assumption is not correct. Only the X variable is used to generate the spline effects. Notice that the EFFECT statement only refers to the WEIGHT variable in your example.
Here is the documentation for the spline effects, in case you want to read more details.
Thanks for the clarification Rick! For RCS, I suppose the transformation mainly depends on the number of knots and the knot locations.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.