BookmarkSubscribeRSS Feed
RebN
Calcite | Level 5

I am using proc lifetest to create survival plots. I want to change the minimum on the y-axis from 0 to, say, 0.5. I have not had success following the SAS documentation and I am not well versed in proc template. I have tried running this proc template and then running my lifetest code but I do not quite understand how to get this template "into" the lifetest procedure.

 

Can someone please advise?? Thank you!

 

proc template;

 define statgraph Stat.Lifetest.Graphics.ProductLimitSurvival; 
  begingraph;
   layout overlay /
    yaxisopts=(label="Incidence of DM" linearopts=(viewmin=0.5 viewmax=1 tickvaluelist=(0.5 0.6 0.7 0.8 0.9 1.0)));
   endlayout;
  endgraph;
 end;
run;

 

ods graphics on;
proc lifetest data=dm_analysis  method=lt plots=survival intervals=1 to 10 by 1;
 time dm_survt_yr*diabetes(0);
 strata M_cohort;
 where casecon in (0,1) and prev_diabetes=0 and dm_survt_flag=0 and age_20150101 ge 18; 
run;
ods graphics off;

4 REPLIES 4
DanH_sas
SAS Super FREQ

If you submit this statement:

 

ods path show;

 

What does it say in your log?

RebN
Calcite | Level 5

Following that statement, the log is:

 

6900  ods path show;
Current ODS PATH list is:

1. SASUSER.TEMPLAT(UPDATE)
2. SASHELP.TMPLMST(READ)

Jay54
Meteorite | Level 14

First, set ODS TRACE ON; and run PROC LIFETEST with the plot you want.  This will list the template(s) used in the log.  Then, source the template to a .sas file, and open it in the program Editor.  This will show you the GTL code.  Add the proc template; run; around the template code.  

 

Now, change the yaxis viewmin=0.5 in both places in the code.  Compile the template which will save it to your sasuser.templat itemstore.  Now, rerun proc lifetest, and it should use this new template from sasuser for all subsequent runs of proc lifetese.  When you no longer want this modified template, delete it from sasuser (but not from sashelp).

 

Here is the modified output.  Note y-axis.

 

SurvivalPlot_Custom.png

Karen521
Calcite | Level 5

Hi Jay, thank you very much! I spent so much time following another tutorial but didn't work out for me, and your answer helped me out right away!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 4 replies
  • 10828 views
  • 1 like
  • 4 in conversation