BookmarkSubscribeRSS Feed
clementinelrx
Fluorite | Level 6

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;

4 REPLIES 4
ger15xxhcker
Quartz | Level 8

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;
clementinelrx
Fluorite | Level 6
Thank you very much for your answer
FreelanceReinh
Jade | Level 19

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.

clementinelrx
Fluorite | Level 6
Thank you very much for your help

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1841 views
  • 6 likes
  • 3 in conversation