While plotting Survival plot in SAS 9.3 (Windows Platform), I want to use GTL or PROC SGPLOT. I am able to get the things done using annotation and PROC GPLOT, but need to make a template I can use flexibly as needed. Hence, I've used proc template to create a template. I am stuck at one point and require a guidance.
While using PROC GPLOT, I use annotation of desired symbol, "|" as follows:
symbol3 interpol=none v =I line=2 HEIGHT=2 font=bold;
I have tried searching a lot but was unable to find the replacement of this statement in proc template (GTL). I would like to have "|" as symbol for censored observation in survival plot. Also, the same symbol should be displayed in the legend as "| | | Censored Observations".
I've tried using following template, with no luck!
proc template;
define statgraph kmplot;
nmvar _ymin _ymax _yinc _xmin _xmax _xinc;
begingraph /designwidth=9.8in designheight=4.8in border=false ;
discreteattrmap name="treatment" / ignorecase=true;
value "1" / lineattrs=(pattern=1);
value "2" / lineattrs=(pattern=4);
value "3" / lineattrs=(pattern=2);
enddiscreteattrmap;
discreteattrvar attrvar=treatmarkers var=Stratum attrmap="treatment";
legendItem type=line name="line1" / lineattrs=(pattern=1) label="Placebo" ;
legendItem type=line name="line2" / lineattrs=(pattern=4) label="TRTA" ;
legendItem type=line name="line3" / lineattrs=(pattern=2) label="TRTB" ;
legendItem type=marker name="censormkr" / markerattrs=(symbol=plus Weight=bold) label="Censored Observations" ;
layout overlay / yaxisopts=(linearopts=(viewmin=_ymin viewmax=_ymax tickvaluesequence=(start=_ymin end=_ymax increment=_yinc))label = "Log Negative Log SDF" )
xaxisopts=(linearopts=(viewmin=_xmin viewmax=_xmax tickvaluesequence=(start=_xmin end=_xmax increment=_xinc)) label="Log of Time (Days)")
walldisplay=all;
stepplot x=time y=survival / group=treatmarkers lineattrs=(color=black) name="trtlgnd";
scatterplot x=time y=survival / group=Stratum /*markerchar=flag*/ markerattrs=(symbol=plus Weight=bold color=black) name="censored";
referenceline y=.5;
*mergedlegend 'trtlgnd' 'censored';
discretelegend "line1" "line2" "line3" "censormkr"/ valueattrs=(size=10pt) autoitemsize=true location=inside across=1 autoalign=(topright);
endlayout;
endgraph;
end;
run;
I've also tried to use "markerchar=flag" option by creating a flag variable containing desired symbol, by which I do get the Symbol in the plot (without any flexibility of having the symbol as bold), but no luck in getting the symbol in the legend as desired.
Please let me know how to get '|' dynamically, both in the plot and n the legend as well. Let me know if any further details from my end is required.
Thanks in Advance!