BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
js5
Pyrite | Level 9 js5
Pyrite | Level 9

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.

1 ACCEPTED SOLUTION

Accepted Solutions
js5
Pyrite | Level 9 js5
Pyrite | Level 9

I solved the problem differently - it turns out formatted values were too long for displaying. Adding /nolabel was the solution.

View solution in original post

2 REPLIES 2
Jagadishkatam
Amethyst | Level 16

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 = ;
Thanks,
Jag
js5
Pyrite | Level 9 js5
Pyrite | Level 9

I solved the problem differently - it turns out formatted values were too long for displaying. Adding /nolabel was the solution.

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 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1725 views
  • 1 like
  • 2 in conversation