Hello everyone! How can I smooth my Kaplan-Meier curves in SAS?
Context: I am releasing results from a research center. According to their rules, every "step" in the Kaplan-Meier curve needs to have at least X number of respondents. Mine does not meet this requirement so I must smooth out the curve and eliminate the jagged "steps."
Here is my syntax for the Kaplan-Meier curves
proc lifetest data=cancer.modelone method=km plots=survival cs=none notable;
time duration*cancer(0);
strata sex;
symbol1 V=none color=blue line=1;
symbol2 v=none color=red line=1;
title1 font="Arial 11pt" Height=1 Bold 'KM Curve by Sex';
run;Below is an illustration of what I want. I found these examples online but they are STATA outputs (STATA uses Lowess Smoothing ?? - I'm not familiar with STATA).
I am also not familiar with Macros or SQL. Thank you for your time!
Can I apply LOESS to GPLOT?
I have used proc gplot because I wanted to adjust the x and y axis of the Kaplan-Meier figure. I got the output from PROC LIFETEST and used PROC GPLOT as shown:
proc lifetest data=cancer.modelone outsurv=kmgender noprint;
time duration*cancer(0);
strata sex;
symbol1 V=none color=blue line=1;
symbol2 v=none color=red line=2;
title1 font="Arial 11pt" Height=1 Bold 'KM Curve by Sex';
run;
goption reset=all ftext=simplex;
symbol1 line=1 color=blue i=stepj;
symbol2 line=1 color=red i=stepj;
axis1 label=(angle=90 'Survival Probability') order=(0.70 to 1 by .02);
axis2 label=('Time to Cancer Diagnosis (days)') order=(0 to 7875 by 1125);
proc gplot data=cancer.kmgender;
plot survival*duration=sex /vaxis=axis1 haxis=axis2;
title 'Kaplan-Meier Curve by Sex';
run;What would the syntax look like with the LOESS statement?
Thank you!
Nearly 200 sessions are now available on demand in the Innovate Hub.
Watch Now →SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.