Hi,
I was trying to change an axis on proc life test KM plot, and I ran this code from another post:
proc template;
define statgraph Stat.Lifetest.Graphics.ProductLimitSurvival;
begingraph;
layout overlay /
/*xaxisopts=(label="Incidence of DM" linearopts=(viewmin=0.5 viewmax=1 tickvaluelist=(0.5 0.6 0.7 0.8 0.9 1.0)));*/
yaxisopts=(label="Incidence of DM" linearopts=(viewmin=0 viewmax=120 tickvaluelist=(20 40 60 80 100 120)));
endlayout;
endgraph;
end;
run;
Now my proc lifetest does not work as it used to, tells me there is not enough data for this graph even though the dataset is the same and it worked before. Please advice how to reverse this/ come back to previous settings.@pink_poodle Given you've got an environment where things work and to test the theory that the issue is with template Stat.Lifetest.Graphics.ProductLimitSurvival you could do the following:
On the environment/computer where things work:
1. Export the template definition from your working environment to a file
%let source_code=c:\temp\ProductLimitSurvival.sas;
proc template;
source Stat.Lifetest.Graphics.ProductLimitSurvival
/file="&source_code"
;
run;
On the environment/computer where things don't work:
2. Store the file with the template definition to a places where it's accessible from your SAS session.
3. Create a new SAS session.
4. Add a new SAS Session specific item store at the beginning of the template search path and compile the template into there
%let source_code=c:\temp\ProductLimitSurvival.sas;
ods path reset;
ods path show;
/* add work.mystore at beginning of item store search path */
ods path (prepend) work.mystore(update);
ods path show;
/* create item Stat.Lifetest.Graphics.ProductLimitSurvival in item store work.mystore */
proc template;
%include "&source_code" /source2;
run;
/* list newly created item */
proc template;
list Stat.Lifetest.Graphics / store=work.mystore;
run;
5. Execute your proc life test code. If it still shows the same error then the issue you observe is not related to Stat.Lifetest.Graphics.ProductLimitSurvival
I've never touched this template in my environment and though the attached file should reflect otb code.
%put &=syshostinfolong;
%put &=sysvlong;
proc template;
source Stat.Lifetest.Graphics.ProductLimitSurvival
/file="c:\temp\ProductLimitSurvival.sas"
;
run;
28 %put &=syshostinfolong;
SYSHOSTINFOLONG=X64_10PRO WIN 10.0.19041 Workstation
29 %put &=sysvlong;
SYSVLONG=9.04.01M7P080520
30
31 proc template;
32 source Stat.Lifetest.Graphics.ProductLimitSurvival
33 /file="c:\temp\ProductLimitSurvival.sas"
34 ;
NOTE: Path 'Stat.Lifetest.Graphics.ProductLimitSurvival' is in: SASHELP.TMPLSTAT_EN (via SASHELP.TMPLMST).
35 run;
NOTE: PROCEDURE TEMPLATE used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds
Ensure that you create a new SAS session in order to avoid any impact from "leftovers".
If things on your two computers still work differently then extract the template from your other computer (using the code I've shared) and compare it to the one from your machine where you're encountering issues. This to ensure the two templates are really the same.
proc template;
delete Stat.Lifetest.Graphics.ProductLimitSurvival /
store=sasuser.templat;
delete Stat.Lifetest.Graphics.ProductLimitSurvival2 /
store=sasuser.templat;
run;
Assuming you modified templates in sasuser, try to delete them using the code above.
Everything you ever wanted to know about modifying the KM plot is here:
https://support.sas.com/documentation/onlinedoc/stat/151/kaplan.pdf
@pink_poodle Given you've got an environment where things work and to test the theory that the issue is with template Stat.Lifetest.Graphics.ProductLimitSurvival you could do the following:
On the environment/computer where things work:
1. Export the template definition from your working environment to a file
%let source_code=c:\temp\ProductLimitSurvival.sas;
proc template;
source Stat.Lifetest.Graphics.ProductLimitSurvival
/file="&source_code"
;
run;
On the environment/computer where things don't work:
2. Store the file with the template definition to a places where it's accessible from your SAS session.
3. Create a new SAS session.
4. Add a new SAS Session specific item store at the beginning of the template search path and compile the template into there
%let source_code=c:\temp\ProductLimitSurvival.sas;
ods path reset;
ods path show;
/* add work.mystore at beginning of item store search path */
ods path (prepend) work.mystore(update);
ods path show;
/* create item Stat.Lifetest.Graphics.ProductLimitSurvival in item store work.mystore */
proc template;
%include "&source_code" /source2;
run;
/* list newly created item */
proc template;
list Stat.Lifetest.Graphics / store=work.mystore;
run;
5. Execute your proc life test code. If it still shows the same error then the issue you observe is not related to Stat.Lifetest.Graphics.ProductLimitSurvival
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.