Hello, I am having some difficulties with the scaling of my x-axis for a survival curve.
Here is the lifetest procedure used and the results. I would like to scale from 0 to 15 by 5. I have already used xOptions without success and I can't find any other solution on the sas users forum. Thanks
proc lifetest data = &data outsurv = tx method=km plots=survival(atrisk=0 to 15 by 5 outside(0.1)) ;
time &time*event_&time(0);
strata &arm;
ods output Quartiles = med (where=(Percent=50)) CensoredSummary = event HomTests = pv ;
run;
You can achieve this by adding the option "axis=(0 to 15 by 5)" to the PLOTS statement in the PROC LIFETEST step. For example:
PROC LIFETEST DATA = &data
OUTSURV = tx
METHOD = KM
PLOTS = SURVIVAL(ATRISK = 0 TO 15 BY 5 OUTSIDE(0.1) AXIS=(0 TO 15 BY 5));
TIME &TIME*EVENT_&TIME(0);
STRATA &ARM;
ODS OUTPUT
Quartiles = med (WHERE=(Percent=50))
CensoredSummary = event
HomTests = pv
;
RUN;
Hello @clementinelrx and welcome to the SAS Support Communities!
I think using xOptions was a good idea. To test it, I have used a slightly modified version VALUNG1 of the VALUNG dataset from Example 76.1 Product-Limit Estimates and Tests of Association of the PROC LIFETEST documentation
data valung1;
set valung;
survtime=survtime/50;
event_survtime=1-censor;
run;
together with the macro variable definitions
%let data=valung1; %let time=survtime; %let arm=cell;
Now, using
%ProvideSurvivalMacros %let xOptions = shortlabel=XNAME offsetmin=.05 linearopts=(viewmax=15 tickvaluelist=(0 5 10 15) tickvaluefitpolicy=XTICKVALFITPOL); %CompileSurvivalTemplates
(the highlighted values are the changes to the original value of xOptions as found in section "The Macro Variables")
followed by your PROC LIFETEST code I've got the expected x-axis scaling.
With the original templates the scaling would be 0 to 20 by 5. With the modified tickvaluelist= option alone, i.e., using viewmax=MAXTIME, the tick mark 20 would be dropped. Adding viewmax=15 truncated the longest survival curve at x=15+offsetmax.
Similarly, using
viewmax=25 tickvaluelist=(0 5 10 15 20 25)
the x-axis was extended beyond the largest survival or censoring time in the VALUNG1 data.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.