BookmarkSubscribeRSS Feed
mmhxc5
Quartz | Level 8

Hi all,

We are using Kaplan Meier method to model bridge deterioration. What I exactly want is to get smoothed curve output for survival and deterioration as an output in order to prepare graphs in graphing software. I could not generate nice survival plots using SAS. I know smoothed curves for other methods in proc LIFETEST are available, but not available for Kaplan Meier.

 

Could anyone give me a link to a macro or write me a macro to output the Kernel smoothed curve for Kaplan Meier data points?

 

Thanks,

 

4 REPLIES 4
Reeza
Super User
Can you use the output from LIFETEST and pass that to another proc to generate a smooth curve? Though I wonder if you shouldn't be using LIFEREG if you need a smooth curve. It's more normal to use a step curve for survival graphs than smoothed graphs. SAS can generate pretty complicated graphics these days so I'm a bit surprised you couldn't get what you need though it's definitely more work than a point and click software. Though the benefit of code is always, if it needs to be repeated you save the time :).

Rick_SAS
SAS Super FREQ

Please provide the code you are using. If you can provide sample data, that's even better.

mmhxc5
Quartz | Level 8

Thank you @Reeza and @Rick_SAS for your time and interest to help.

The following is the code i am using.

title;
proc LIFETEST method=km data=xx.WI_nbi_psc_super_ticr plots=s(cb=ep)OUTSURV=xx.PSC_Survival;* (atrisk);
TIME count*CENSOR(0);
strata SUPERSTRUCTURE_COND_059;
label count="Time in Condition Rating (Year)";
run;

The data file I used in the above code is attached. The code output and graphs are attached too. I want to smooth the step curves using Kernel smoothing method and have it as an output similar to the code output and possibly overlay it on the graph.

Survival Output.JPG

 

Thanks,

 

Rick_SAS
SAS Super FREQ

Although it is possible to apply a smoother to the points in the K-M graph, I don't recommend it. Smoothers are based on nonparametric regression methods that assume a relationship between the X and Y variables. The predicted values and confidence intervals for a smoother are based on assumptions that probably do not hold for the K-M points.

 

If you decide to proceed anyway, you can use the LOESS or PBSPLINE statements in PROC SGPLOT to overlay a smoother on the data. For example, here is a PBSPLINE smoother:

 

proc lifetest method=km data=sashelp.BMT plots=s(cb=ep) OUTSURV=PSC_Survival;
   time T * Status(0);
   strata Group;
run;

proc sort data=PSC_Survival;
by Group T;
run;

proc sgplot data=PSC_Survival;
band x=T lower=SDF_LCL upper=SDF_UCL / group=Group transparency=0.6;
pbspline x=T y=Survival / group=Group;  /* or use LOESS */
run;

SAS Innovate 2025: Call for Content

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!

Submit your idea!

What is ANOVA?

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.

Discussion stats
  • 4 replies
  • 1322 views
  • 2 likes
  • 3 in conversation