I am looking for help in to regain my ability to graph the survival probability plot/graph from the PROC LIFETEST output.
I was trying to change the intervals on the y-axis and after googling how to do this, I tried a proc template and I lost the the graphing ability entirely. I tried to use ODS GRAPHICS ON; to see if that worked and it didn't. I keep getting this warning in the log.
WARNING: Insufficient data to produce 'Stat.Lifetest.Graphics.ProductLimitSurvival' Graph.
All I wanted was to adjust the y-axis range and now by trying something I had no idea what I was doing or what would happen, I now lost the graphing ability entirely. I need it back. Can someone please help?
If you have not done so already I would save the program code and restart SAS.
Then see if the PREVIOUS plot without any template changes will work.
If it doesn't plot then you will have to show us the code of the attempted template change.
Likely the plot template code modified one of the SAS supplied templates and you need to restore that. Hopefully the code you used actually only provided a modified copy in a new location that needs to be cleared.
For most procedures when it comes to making custom graphs I output data from the analysis procedure into a data set (or 2 or 3) and then use that data in one of the graphing procedures like SGPlot or SGPanel because the attempts to modify a lot of the plots in the procedures like Lifetest are just a bit esoteric.
Google may sometimes help but you might start with the online help installed with SAS and look for "Customizing the Kaplan-Meier Survival Plot"
There is an example that specifically shows changing Y-axis values
%ProvideSurvivalMacros %let yOptions = label="Survival" linearopts=(viewmin=0 viewmax=1 tickvaluelist=(0 .25 .5 .75 1)); %CompileSurvivalTemplates proc lifetest data=sashelp.BMT plots=survival(cb=hw test); time T * Status(0); strata Group; run;
What that example does: The %ProvideSurvivalMacros compiles a set of macros for use with the KM plots so they are available in the current session.
The second line overrides some of the Yaxis options from the default just compiled of
/* DEFAULT yoptions*/ %let yOptions = label="Survival Probability" shortlabel="Survival" linearopts=(viewmin=0 viewmax=1 tickvaluelist=(0 .2 .4 .6 .8 1.0));
a quick comparison shows the LABEL= value has changed and that the tick mark values have changed (I think this is the bit that you want.
The %CompileSurvivalTemplates then re-compiles the survival template macros that are called by the procedure to make the plots but incorporates the Yoptions set. Pick the values you want to appear as the Y axis tick marks in the value list. Watch the matching parentheses! Do not use any commas inside the Yoptions.
If you have something with Proc Template starting from scratch then likely that is likely overkill
Thanks so much. I think I found this same code when googling etc. I tried it, but maybe I was doing something wrong. I am very new to this, but will try again tomorrow. I was able to regain my ability to create a graph/plot again.
I found this code that reset my settings and got everything back.
ods path sashelp.tmplmst(read);
proc datasets library=sasuser nolist;
ods path reset;
Thanks so much for getting back to me. I will let you know if the suggested code you shared worked.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.