BookmarkSubscribeRSS Feed
Gail28
Fluorite | Level 6

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?

 

thanks.

Gail28

 

 

 

4 REPLIES 4
ballardw
Super User

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

Gail28
Fluorite | Level 6

Hi ballardw...

 

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;
delete templat(memtype=itemstor);
run;
ods path reset;

 

Thanks so much for getting back to me.  I will let you know if the suggested code you shared worked.

Gail28
Fluorite | Level 6

I think i may end up taking the option out putting the data and kind of trying another plotting procedure performing another patchwork method to focus on graphing the data of interest.

Reeza
Super User
There are a ton of examples that do this, check the SAS blogs for several example codes using SGPLOT.

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
  • 4 replies
  • 1164 views
  • 4 likes
  • 3 in conversation