Hello SAS experts, I am trying to create some plots with annotations using PROC TEMPLATE. Currently, I have the annotations set up using an annotation dataset (rather than incorporating the annotations into the PROC TEMPLATE procedure itself using statements such as drawtext). I am getting it close to working correctly, but the annotations are appearing for all BY groups in each plot. That is, BY group=1 shows annotations for all BY groups, even though I have the BY group variable in the annotations dataset. Is there a way I can have the annotations show only for each corresponding BY group? Sample code to reproduce my plot is below: data graphdata;
input rpt_strat $ est delta level CI;
format Est CI percentn11.2;
datalines;
20-to-44 -.0383 -0.002374357 0.05 -.0572
20-to-44 . -0.002374357 0.05 -.0195
45-to-64 -.0317 -0.004262066 0.05 -.0525
45-to-64 . -0.004262066 0.05 -.0109
;
run;
ods path(prepend) Work.Templat(update);
%SGANNO;
data anno;
set graphdata;
if Est ~= .;
%SGTEXT(label="Estimate", x1=Est, y1=75, x1space='datavalue', y1space='graphpercent', anchor='center',width=200, widthunit='pixel');
keep rpt_strat;
run;
proc template;
define statgraph CIPlot;
begingraph / designwidth=800px designheight=200px;
layout overlay / yaxisOpts=(display=none)
xAxisOpts=(label="Rate");
annotate;
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;
proc sgrender data=graphdata template=CIPlot sganno=anno;
by rpt_strat;
title1 "Non-inferiority Confidence Interval for Measure";
title2 "Ages #byval1";
run; Note that "Estimate" is being displayed twice on each graph: it should only be displayed once per graph, above the big blue dot. Is there a way to fix this? Also, if anyone knows how to suppress the automatic BY group heading "rpt_strat=20-to-44" and "rpt_strat=45-to-64" I'd appreciate that too! I'm using SAS 9.4 TS1M5 Thank you, Brian
... View more