I'm studying the association between body mass index (BMI) and mortality in different cohorts. I´ve been running multivariable cox model restricted cubic splines using the macro lgtphcurv9 (https://cdn1.sph.harvard.edu/wp-content/uploads/sites/271/2012/09/lgtphcurv9_7-3-2011.pdf) to plot the association between BMI and mortality, which is u-shaped. I'm interested in the lowest risk BMI value and its 95% confidence interval. To get the lowest risk value, I just went to the output table which provides a long table with all the BMI values and the estimate (HR, which then is plotted in a figure), and record the lowest risk value. However, I'm struggling in getting 95% confidence intervals of this value.
I understand that doing bootstrapping can be an option to create this 95% CI, but I dont know how to run bootstrapping through this macro...
can anybody help me with this?
thanks
Pablo
Bootstrapping involves selecting Subsamples and running it through the macro and collecting the parameter estimates.
Usually I would recommend David Cassells paper - Don't be loopy, but without knowing your macro in detail (I'm not going to read 50+ pages) I'm not sure it can handle BY group processing. If it can, read Davids paper and follow that method otherwise, you can use the method not recommended in his paper, creating a macro that samples, calls the macro and collects the results.
You dont need bootstrapping. The confidence intervals can be calculated with use of the effect-statement, and the PROC PLM, which should be used after running phreg. Its quite easy, as this example shows.
*first generate some data;
data mydata;
do i=1 to 10000;
bmi=rand('uniform',0,10);
time=rand('exponential',exp(-sin(bmi)));
output;
end;
run;
*estimate the spline, and store the result file;
proc phreg data=mydata;
effect myspline=spline(bmi / knotmethod=list(1,2,3,4,5,6,7,8,9) naturalcubic);
model time=myspline;
store result;
run;
*generate the number of bmi-values where the values should be calcuated;
data template;
do bmi=0 to 10 by 0.01;
output;
end;
run;
*then calculate the curve;
proc plm restore=result;
score data=template out=predicted predicted=predicted lclm=lclm uclm=uclm;
run;
*transform to hazard-ratio scale ;
data predicted;
set predicted;
exppredicted=exp(predicted);
explclm=exp(lclm);
expuclm=exp(uclm);
y=exp(sin(bmi));
ruN;
*plot it!;
symbol1 i=join l=1 v=none color=black;
symbol2 i=join l=2 v=none color=black;
symbol3 i=join l=2 v=none color=black;
symbol4 i=join l=1 v=none color=red;
proc gplot data=predicted;
plot (exppredicted explclm expuclm y)*bmi/overlay;
run;
The paper you're referencing was for SAS 9.1 which is at least a decade old. It looks like,the functionality desired regarding cox regression model with spline has been implemented in SAS now. I would review Jacobs answer and assume that he's correct over my answer.
Re finding the paper, search at Lexjansen.com, in general you can find a paper there on almost any SAS topic.
Thanks Reeza,
can you provide more details to find Davis paper?
thanks!
pablo
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.