Hi,
Is there a way I can specify particular colors in KM plot using proc lifetest?
I tried
%ProvideSurvivalMacros %let GraphOpts = DataContrastColors=(green red blue) DataColors=(green red blue); %CompileSurvivalTemplates
from the link https://support.sas.com/documentation/onlinedoc/stat/131/kaplan.pdf
but it doesn't seem to work.
The surv macro should work. Please post your full code and and the log. If you cannot use your real data please feel free to use a dataset from the documentation or sashelp.heart
@sfo wrote:
Hi,
Is there a way I can specify particular colors in KM plot using proc lifetest?
I tried
%ProvideSurvivalMacros %let GraphOpts = DataContrastColors=(green red blue) DataColors=(green red blue); %CompileSurvivalTemplates
from the link https://support.sas.com/documentation/onlinedoc/stat/131/kaplan.pdf
but it doesn't seem to work.
Thanks for your help.
This is the log:
ERROR: Template 'Stat.Lifetest.Graphics.ProductLimitSurvival' was unable
to write to template store!
ERROR: Template 'Stat.Lifetest.Graphics.ProductLimitSurvival2' was unable
to write to template store!
and this is how I am doing in my code:
ods pdf file="&dir\OAK_KM_&fn._Plot_%sysfunc(date(),yymmdd10.).pdf" style=HMTLBlue;
ods listing close;
ods graphics on;
goptions xmax=5 ymax=4 xpixels=1500 ypixels=1200;
%ProvideSurvivalMacros
%let GraphOpts = DataContrastColors=(green red blue)
DataColors=(green red blue black);
%CompileSurvivalTemplates
ODS EXCLUDE ProductLimitEstimates;
proc lifetest data=OS_Titer_KM plots=survival(atrisk);
time TIME*censor(1);
strata A;
run;
Try deleting the templates and try again?
proc template;
delete Stat.Lifetest.Graphics.ProductLimitSurvival /
store=sasuser.templat;
delete Stat.Lifetest.Graphics.ProductLimitSurvival2 /
store=sasuser.templat;
run;
I tried again and getting the attached error log and below is my code:
proc template;
delete Stat.Lifetest.Graphics.ProductLimitSurvival /
store=sasuser.templat;
delete Stat.Lifetest.Graphics.ProductLimitSurvival2 /
store=sasuser.templat;
run;
data _null_;
%let url = //support.sas.com/documentation/onlinedoc/stat/ex_code/131;
infile "http:&url/templft.html" device=url;
file 'macros.tmp';
retain pre 0;
input;
if index(_infile_, '</pre>') then pre = 0;
if pre then put _infile_;
if index(_infile_, '<pre>') then pre = 1;
run;
%inc 'macros.tmp' / nosource;
%ProvideSurvivalMacros
%let GraphOpts = DataContrastColors=(green red blue black)
DataColors=(green red blue black);
%CompileSurvivalTemplates
ods graphics on;
proc lifetest data=data
plots=survival(cb=hw test atrisk(outside maxlen=13));
time TIME*censor(1);
strata T_Titer;
by ACTARM1;run;
ods graphics off;
Thanks I have contacted tech support.
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.