BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
tan-wongv
Obsidian | Level 7

I ran the following code and got the curve below.

proc lifetest data=sasuser.combine_aim2n2 plots=survival(f) timelist=(0 to 132 by 12);
time month2*ui2(0);
run;

Screenshot 2024-05-15 021346.png

Would there be a way to change the scale of x axis from 0 25 50 75 100 125 to 0 12 24 36 48 60 72 84 96 108 120 132? 

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hello @tan-wongv,

 


@tan-wongv wrote:

Would there be a way to change the scale of x axis from 0 25 50 75 100 125 to 0 12 24 36 48 60 72 84 96 108 120 132? 


Yes, I see three ways to do this, the simplest of which is a combination of three survival (plot) options:

  • Specify those tick marks in the ATRISK option.
  • Add the ATRISKTICKONLY option.
  • Make the "At Risk" display invisible by using a tiny proportion in the OUTSIDE option.
proc lifetest data=sasuser.combine_aim2n2 plots=survival(f atrisk(outside(1e-6))=0 to 132 by 12 atrisktickonly);
time month2*ui2(0);
run;

It is possible, though, that the last tick mark (132) is not displayed if the greatest failure time is less than 132.

 

The other two ways are more cumbersome:

  • Write the data needed for the plot to a dataset (by using the OUTSURV= option of the PROC LIFETEST statement and a subsequent DATA step) and then use PROC SGPLOT to create the plot where you have the XAXIS statement and its various options available.
  • Modify a copy of the ODS template underlying the plot, which is Stat.Lifetest.Graphics.ProductLimitFailure. Change the first occurrence of
    linearopts=(viewmax=MAXTIME tickvaluelist=XTICKVALS ...
    in the PROC TEMPLATE code to
    linearopts=(viewmax=132 tickvaluelist=(0 12 24 36 48 60 72 84 96 108 120 132) ...

View solution in original post

2 REPLIES 2
FreelanceReinh
Jade | Level 19

Hello @tan-wongv,

 


@tan-wongv wrote:

Would there be a way to change the scale of x axis from 0 25 50 75 100 125 to 0 12 24 36 48 60 72 84 96 108 120 132? 


Yes, I see three ways to do this, the simplest of which is a combination of three survival (plot) options:

  • Specify those tick marks in the ATRISK option.
  • Add the ATRISKTICKONLY option.
  • Make the "At Risk" display invisible by using a tiny proportion in the OUTSIDE option.
proc lifetest data=sasuser.combine_aim2n2 plots=survival(f atrisk(outside(1e-6))=0 to 132 by 12 atrisktickonly);
time month2*ui2(0);
run;

It is possible, though, that the last tick mark (132) is not displayed if the greatest failure time is less than 132.

 

The other two ways are more cumbersome:

  • Write the data needed for the plot to a dataset (by using the OUTSURV= option of the PROC LIFETEST statement and a subsequent DATA step) and then use PROC SGPLOT to create the plot where you have the XAXIS statement and its various options available.
  • Modify a copy of the ODS template underlying the plot, which is Stat.Lifetest.Graphics.ProductLimitFailure. Change the first occurrence of
    linearopts=(viewmax=MAXTIME tickvaluelist=XTICKVALS ...
    in the PROC TEMPLATE code to
    linearopts=(viewmax=132 tickvaluelist=(0 12 24 36 48 60 72 84 96 108 120 132) ...
tan-wongv
Obsidian | Level 7

Thank you very much for your help!

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 25. 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
  • 361 views
  • 1 like
  • 2 in conversation