I tried to draw Kaplan-Meier curve using proc lifetest and ODS graphics.
Using % let InsetOpts and StmtsBottom in the Macro, I want to display inset table including No. and events.
I have 4 groups but only first 3 groups are displayed on Survival Curve.
How can I display 4 groups of No. and events?
data _null_;
%let url = //support.sas.com/documentation/onlinedoc/stat/ex_code/141;
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 InsetOpts = autoalign=(BottomLeft)
border=true BackgroundColor=GraphWalls:Color Opaque=true;
%macro StmtsBottom;
dynamic %do i = 1 %to 3; StrVal&i NObs&i NEvent&i %end;;
layout gridded / columns=3 border=true autoalign=(BottomRight);
entry ""; entry "No."; entry "Events";
%do i = 1 %to 3;
%let t = / textattrs=GraphData&i;
entry halign=right Strval&i &t; entry NObs&i &t; entry NEvent&i &t;
%end;
endlayout;
%mend;
%CompileSurvivalTemplates
proc format;
value CATEGORY
1 = "A"
2 = "B"
3 = "C"
4 = "D";
RUN;
ODS Graphics ON;
PROC LIFETEST data= File_Name
plots=survival (atrisk test) notable;
TIME FU_time * events (0);
STRATA category;
format category category.;
RUN;
ODS Graphics OFF;