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.
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.
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.