Dear community,
I am having an issue with proc lifetest, ods graphics and two strata variables. I can plot Kaplan-Meier curves with each strata variable individually without issues, but if I try to plot them both at once the legend disappears. I tried turning it back on with maxlegendarea=100 but it does not help.
With ods graphics turned off the legend is there but the graph looks super ugly. Here is the code in question:
ods graphics on /show maxlegendarea=100;
ods escapechar="~";
ods powerpoint image_dpi=450
file="foo.pptx";
footnote "foo~nbar~nbaz";
title "Progression Free Survival";
title2 "foo";
proc lifetest data=adtte(where=(AFL EQ "Y" and BFL EQ "N" and PARAM EQ "PFS")) plots=survival notable;
time EVENTDY * CENSORED(1);
strata SUBGR_A SUBGR_B;
quit;
title;
title2;
footnote;
ods powerpoint close;
I cannot share the data unfortunately. Is there any other setting controlling the presence of legend? K-M plot with 5 lines (one combination is empty) is pretty useless if one has to guess which line corresponds to which stratum.
I solved the problem differently - it turns out formatted values were too long for displaying. Adding /nolabel was the solution.
The legend is suppressed when the LegendOpts
macro variable is null.Please use the below macro variable to suppress the legend,
please place this macro variable before the proc lifetest and run the code.
%let LegendOpts = ;
I solved the problem differently - it turns out formatted values were too long for displaying. Adding /nolabel was the solution.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.