I want to change proc lifetest y axis. It seems I can use macros to change it.
%ProvideSurvivalMacros
%let yOptions = label="Survival"
linearopts=(viewmin=0.2 viewmax=1
tickvaluelist=(0 .2 .4 .6 .8 1.0));
%CompileSurvivalTemplates
However, I don’t have permission to compile the template in SASUSER .templat. Is there a way to use an updated ‘Stat.Lifetest.Graphics.ProductLimitSurvival’ in work.templat?
No idea what those macros are or what code they generate, but in general where templates are written are determined by ODS PATH statements.
You can see your current setting by looking at the automatic macro variable SYSODSPATH. Example:
1 %put &=sysodspath ;
SYSODSPATH= SASUSER.TEMPLAT(UPDATE) SASHELP.TMPLMST(READ)
Or use ODS PATH SHOW statement.
So try pointing the options to write to WORK instead and to read from WORK before the others. Example:
ods path work.templat(update) SASUSER.TEMPLAT(read) SASHELP.TMPLMST(READ) ;
Then try using your macros.
Thank you, Tom. I specified the path to work.templat as follows:
ods path work.templat(update) SASUSER.TEMPLAT(read) SASHELP.TMPLMST(READ) ;
The macros are working in ' work.templat'. However, when I ran proc lifetest , the procedure pointed to SASUSER.TEMPLAT again. I'm not sure if I can instruct the 'proc lifetest' procedure to point to work.templat. I use the following codes to get the plot. Many functions in the procedure are very nice, and the modularized templates would be very useful if I could point the 'proc lifetest' procedure to work.templat.
proc lifetest data=bmt plots=(survival);
time ftime*Status(0);
strata diagnosis;
run;
data _null_; %let url = //support.sas.com/documentation/onlinedoc/stat/ex_code/151; infile "http:&url/templft.html" device=url; file 'macros.tmp'; retain pre 0; input; _infile_ = tranwrd(_infile_, '&', '&'); _infile_ = tranwrd(_infile_, '<' , '<'); 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 yOptions = label="Survival"
linearopts=(viewmin=0.2 viewmax=1
tickvaluelist=(0 .2 .4 .6 .8 1.0));
%CompileSurvivalTemplates
Thanks!
If you don't want to use templates from your SASUSER library then do not include that catalog in the ODS PATH statement.
ods path work.templat(update) SASHELP.TMPLMST(READ) ;
You could save data from proc lifetest and customize it by PROC SGPLOT .
proc format;
value grpLabel 1='ALL' 2='AML low risk' 3='AML high risk';
run;
data BMT;
input DIAGNOSIS Ftime Status Gender@@;
label Ftime="Days";
format Diagnosis grpLabel.;
datalines;
1 2081 0 1 1 1602 0 1
1 1496 0 1 1 1462 0 0
1 1433 0 1 1 1377 0 1
1 1330 0 1 1 996 0 1
1 226 0 0 1 1199 0 1
1 1111 0 1 1 530 0 1
1 1182 0 0 1 1167 0 0
1 418 2 1 1 383 1 1
1 276 2 0 1 104 1 1
1 609 1 1 1 172 2 0
1 487 2 1 1 662 1 1
1 194 2 0 1 230 1 0
1 526 2 1 1 122 2 1
1 129 1 0 1 74 1 1
1 122 1 0 1 86 2 1
1 466 2 1 1 192 1 1
1 109 1 1 1 55 1 0
1 1 2 1 1 107 2 1
1 110 1 0 1 332 2 1
2 2569 0 1 2 2506 0 1
2 2409 0 1 2 2218 0 1
2 1857 0 0 2 1829 0 1
2 1562 0 1 2 1470 0 1
2 1363 0 1 2 1030 0 0
2 860 0 0 2 1258 0 0
2 2246 0 0 2 1870 0 0
2 1799 0 1 2 1709 0 0
2 1674 0 1 2 1568 0 1
2 1527 0 0 2 1324 0 1
2 957 0 1 2 932 0 0
2 847 0 1 2 848 0 1
2 1850 0 0 2 1843 0 0
2 1535 0 0 2 1447 0 0
2 1384 0 0 2 414 2 1
2 2204 2 0 2 1063 2 1
2 481 2 1 2 105 2 1
2 641 2 1 2 390 2 1
2 288 2 1 2 421 1 1
2 79 2 0 2 748 1 1
2 486 1 0 2 48 2 0
2 272 1 0 2 1074 2 1
2 381 1 0 2 10 2 1
2 53 2 0 2 80 2 0
2 35 2 0 2 248 1 1
2 704 2 0 2 211 1 1
2 219 1 1 2 606 1 1
3 2640 0 1 3 2430 0 1
3 2252 0 1 3 2140 0 1
3 2133 0 0 3 1238 0 1
3 1631 0 1 3 2024 0 0
3 1345 0 1 3 1136 0 1
3 845 0 0 3 422 1 0
3 162 2 1 3 84 1 0
3 100 1 1 3 2 2 1
3 47 1 1 3 242 1 1
3 456 1 1 3 268 1 0
3 318 2 0 3 32 1 1
3 467 1 0 3 47 1 1
3 390 1 1 3 183 2 0
3 105 2 1 3 115 1 0
3 164 2 0 3 93 1 0
3 120 1 0 3 80 2 1
3 677 2 1 3 64 1 0
3 168 2 0 3 74 2 0
3 16 2 0 3 157 1 0
3 625 1 0 3 48 1 0
3 273 1 1 3 63 2 1
3 76 1 1 3 113 1 0
3 363 2 1
;
run;
ods select none;
ods output SurvivalPlot=SurvivalPlot;
proc lifetest data=bmt plots=(survival);
time ftime*Status(0);
strata diagnosis;
run;
ods select all;
title '缓解概率';
proc sgplot data=SurvivalPlot;
step x=Time y=Survival / group=Stratum lineattrs=(pattern=solid) ;
scatter x=Time y=Censored / group=Stratum markerattrs=(symbol=plus);
inset '+ Censored'/position=ne border;
yaxis values=(0 to 1 by 0.1);
run;
Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.