BookmarkSubscribeRSS Feed
sfo
Quartz | Level 8 sfo
Quartz | Level 8

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.

8 REPLIES 8
Cynthia_sas
SAS Super FREQ
Hi:
Did you follow the instructions on page 799 to download and store the macro code in a temporary file? If you followed the instructions and it's not working for you, then you'll want to open a track with Tech Support on this.

Cynthia
Reeza
Super User

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.


 

sfo
Quartz | Level 8 sfo
Quartz | Level 8

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;

Reeza
Super User

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;
Reeza
Super User
Also, I tried to run your code as is and there were some weird issues, not sure if that was introduced from copy/pasting from here or from documentation. Either way, the code works when I typed it out manually step by step again.
sfo
Quartz | Level 8 sfo
Quartz | Level 8

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;

Reeza
Super User
I think you need to contact tech support now. That shouldn't happen. If you're working with SAS UE that may be part of it, because the SASuser library isn't writeable in that edition.
sfo
Quartz | Level 8 sfo
Quartz | Level 8

Thanks I have contacted tech support.

sas-innovate-2024.png

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.

 

Register now!

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
  • 8 replies
  • 2230 views
  • 0 likes
  • 3 in conversation