Hi all,
I see many posts on how to customize the KM graph.
However, I just need the basic one and would like to ask if we can customize the vertical axis within PROC LIFETEST?
The codes below will give me a full graph of the survival probability from 0 to 1.
Is there anyway to limit it to 0.8 to 1? That will zoom out the graph.
Thank you!
Hao
ODS html; ODS graphics on;
PROC LIFETEST data=table2 plots=survival (nocensor test atrisk(outside maxlen=13)=0 to 9 by 1) maxtime=9;
TIME time*outcome (0);
STRATA TREATMENT /test=logrank order=internal adjust=sidak;
LABEL TREATMENT ='Legend:';
RUN;
ODS graphics off;
ODS html close;
Have you tried changing the viewmin/viewmax values or the tickvalue list as illustrated in this example from the documentation?
https://documentation.sas.com/doc/en/pgmsascdc/v_010/statug/statug_kaplan_sect018.htm
Basically you just need to add the following before your code:
%ProvideSurvivalMacros;
%let yOptions = label="Survival"
linearopts=(viewmin=0.8 viewmax=1
tickvaluelist=(0.8 .9 1));
%CompileSurvivalTemplates;
@haoduonge wrote:
Hi all,
I see many posts on how to customize the KM graph.
However, I just need the basic one and would like to ask if we can customize the vertical axis within PROC LIFETEST?
The codes below will give me a full graph of the survival probability from 0 to 1.
Is there anyway to limit it to 0.8 to 1? That will zoom out the graph.
Thank you!
Hao
ODS html; ODS graphics on;
PROC LIFETEST data=table2 plots=survival (nocensor test atrisk(outside maxlen=13)=0 to 9 by 1) maxtime=9;
TIME time*outcome (0);
STRATA TREATMENT /test=logrank order=internal adjust=sidak;
LABEL TREATMENT ='Legend:';
RUN;
ODS graphics off;
ODS html close;
Have you tried changing the viewmin/viewmax values or the tickvalue list as illustrated in this example from the documentation?
https://documentation.sas.com/doc/en/pgmsascdc/v_010/statug/statug_kaplan_sect018.htm
Basically you just need to add the following before your code:
%ProvideSurvivalMacros;
%let yOptions = label="Survival"
linearopts=(viewmin=0.8 viewmax=1
tickvaluelist=(0.8 .9 1));
%CompileSurvivalTemplates;
@haoduonge wrote:
Hi all,
I see many posts on how to customize the KM graph.
However, I just need the basic one and would like to ask if we can customize the vertical axis within PROC LIFETEST?
The codes below will give me a full graph of the survival probability from 0 to 1.
Is there anyway to limit it to 0.8 to 1? That will zoom out the graph.
Thank you!
Hao
ODS html; ODS graphics on;
PROC LIFETEST data=table2 plots=survival (nocensor test atrisk(outside maxlen=13)=0 to 9 by 1) maxtime=9;
TIME time*outcome (0);
STRATA TREATMENT /test=logrank order=internal adjust=sidak;
LABEL TREATMENT ='Legend:';
RUN;
ODS graphics off;
ODS html close;
It is so strange, I add that before my codes and the figure does not change a bit.
Hao
I got it, thank you!
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.