Another way is to use the ID column in your Anno data set to subset your annotate observations. In this case, the ID column value would be the same as the rpt_strat column. To create the ID column, add parameter id=rpt_strat to the %SGTEXT macro call in your Anno DATA step:
data anno;
set graphdata;
if Est ~= .;
%SGTEXT(id=rpt_strat, label="Estimate", x1=Est, y1=75, x1space='datavalue', y1space='graphpercent', anchor='center',width=200, widthunit='pixel');
keep rpt_strat;
run;
In your CIPlot template code, to get the BY-Group variable value into your template, create dynamic variable _BYVAL_, and then in your ANNOTATE statement, add option ID = _BYVAL_:
proc template;
define statgraph CIPlot;
dynamic _BYVAL_;
begingraph / designwidth=800px designheight=200px;
layout overlay / yaxisOpts=(display=none)
xAxisOpts=(label="Rate");
annotate / id=_BYVAL_;
scatterplot x=Est y=level / markerattrs=(symbol=circlefilled size=10) datalabel=Est datalabelposition=top;
seriesplot x=CI y =level / display=(markers) markerattrs=(symbol=ibeam size=10) datalabel=CI datalabelposition=top;
referenceline x=delta / lineattrs=(pattern=2);
referenceline x=0 / lineattrs=(pattern=1);
endlayout;
endgraph;
end;
run;
Finally, to suppress the automatic BY-line, specify system option NOBYLINE:
options nobyline;
proc sgrender data=graphdata template=CIPlot sganno=anno;
by rpt_strat;
title1 "Non-inferiority Confidence Interval for Measure";
title2 "Ages #byval1";
run;
options byline; /* Restore BY-line */
You can find information about subsetting annotate observations in Subsetting Annotations in SAS Graph Template Language: User’s Guide. Hope this helps.
Steve
... View more