Hello Everyone,
I have created a survival graph with multiple groups as below.
As you look here it is a bit clustered at the top of the graph.
Is there any procedure or way to zoom the graph? so can analyze properly.
ODS PDF file='survival_Ethnicity white race by SES.pdf';
ods graphics on / imagefmt=png imagename= "Surival for Ethnicity by White Race and SES";
proc lifetest data = adsl3 method=KM plots=s(test)
timelist = 0 1 2 5 10 15 20 25 30 CONFTYPE= linear;
time Years*death(0);
strata race_ses_white;
title1 "Overall Survival Ethnicity by White Race by SES";
run ;
Hi @RAVI2000,
Perhaps you can use the MIN option in the YAXIS statement to make the graph go from 0.4 to 1.
Please see the example below:
options nodate nonumber;
ods escapechar='^';
ods listing close;
ods graphics on;
ods output survivalplot = sj.survplot;
proc lifetest data = sj.adsl3 method = km plots=s(test)
timelist = 0 1 2 5 10 15 20 25 30 conftype = linear;
time years * death(0);
strata ses;
run;
ods tagsets.rtf file = "/home/Projects/programs/exhibit_01.rtf";
ods graphics on / height = 8in width = 9in;
title1 j=c h=12pt font = arial "Overall Survival by SES";
proc sgplot data = sj.survplot;
step x=time y=survival /group=stratum name='s' lineattrs=(pattern=solid);
xaxis label="Years" values=(0 to 5 by 1);
yaxis label="Survival Probability" values=(0.4 to 1 by 0.2);
scatter x=time y=censored / markerattrs=(symbol=plus) name='c';
scatter x=time y=censored / markerattrs=(symbol=plus) group=stratum;
keylegend 'c'/location=inside position=topright;
keylegend 's'/location=inside position=bottomleft;
run;
ods tagsets.rtf close;
ods listing;
May also want to set the graph to make a wider display using Ods graphics /width = <something>.
Or create a data set and use that data for SGPLOT where you can apply more controls.
options nodate nonumber;
ods escapechar='^';
ods listing close;
ods graphics on;
ods output survivalplot = sj.survplot;
proc lifetest data = sj.adsl3 method = km plots=s(test)
timelist = 0 1 2 5 10 15 20 25 30 conftype = linear;
time years * death(0);
strata ses;
run;
ods tagsets.rtf file = "/home/Projects/programs/exhibit_01.rtf";
ods graphics on / height = 8in width = 9in;
title1 j=c h=12pt font = arial "Overall Survival by SES";
proc sgplot data = sj.survplot;
step x=time y=survival /group=stratum name='s' lineattrs=(pattern=solid);
xaxis label="Years" values=(0 to 5 by 1);
yaxis label="Survival Probability" values=(0 to 1 by 0.2);
scatter x=time y=censored / markerattrs=(symbol=plus) name='c';
scatter x=time y=censored / markerattrs=(symbol=plus) group=stratum;
keylegend 'c'/location=inside position=topright;
keylegend 's'/location=inside position=bottomleft;
run;
ods tagsets.rtf close;
ods listing;
I have given height and width option in ODS but still not getting desired output zoomed.
I still feel the graph is clustered. Any other options @ballardw @Ksharp @whymath ? Thankyou!
Hi @RAVI2000,
Perhaps you can use the MIN option in the YAXIS statement to make the graph go from 0.4 to 1.
Please see the example below:
options nodate nonumber;
ods escapechar='^';
ods listing close;
ods graphics on;
ods output survivalplot = sj.survplot;
proc lifetest data = sj.adsl3 method = km plots=s(test)
timelist = 0 1 2 5 10 15 20 25 30 conftype = linear;
time years * death(0);
strata ses;
run;
ods tagsets.rtf file = "/home/Projects/programs/exhibit_01.rtf";
ods graphics on / height = 8in width = 9in;
title1 j=c h=12pt font = arial "Overall Survival by SES";
proc sgplot data = sj.survplot;
step x=time y=survival /group=stratum name='s' lineattrs=(pattern=solid);
xaxis label="Years" values=(0 to 5 by 1);
yaxis label="Survival Probability" values=(0.4 to 1 by 0.2);
scatter x=time y=censored / markerattrs=(symbol=plus) name='c';
scatter x=time y=censored / markerattrs=(symbol=plus) group=stratum;
keylegend 'c'/location=inside position=topright;
keylegend 's'/location=inside position=bottomleft;
run;
ods tagsets.rtf close;
ods listing;
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.