Hi All, I’m trying to display the error bars in the legend of my SGPLOT output. I’m using the following code to generate the graph, but I haven’t been able to figure out why the error bars are not appearing in the legend.
Could someone please help me identify what’s going wrong with the code?
proc sgplot data=have dattrmap=test noautolegend noborder;
styleattrs datacontrastcolors=(black blue red lime) datasymbols=(Asterisk Circle TriangleDown Triangle);
series x=xvar y=mn / name="scatter1" group=trt attrid=X markers;
scatter x=xvar y=mn / name="scatter2" group=trtan yerrorlower=lower
yerrorupper=upper
markerattrs=(size=8)
errorbarattrs=(thickness=1);
legenditem type=markerline name="A" /
label="A (N=%trim(&A))" lineattrs=GraphData1 markerattrs=GraphData1;
legenditem type=markerline name="B" /
label="B (N=%trim(&B))" lineattrs=GraphData2 markerattrs=GraphData2;
legenditem type=markerline name="C" /
label="C (N=%trim(&C))" lineattrs=GraphData3 markerattrs=GraphData3;
legenditem type=markerline name="D" /
label="D (N=%trim(&D))" lineattrs=GraphData4 markerattrs=GraphData4;
keylegend "A" "B" "C" "D"/ location=inside noborder opaque position=TOPRIGHT across=1 down=4;
yaxis label="Plasma (ug/L)" values = (0 200 400 600 800 1000) TICKSTYLE=INSIDE offsetmin=0.05
valueattrs=(family="Times New Roman" size=9) labelattrs=(family="Times New Roman" size=9);
xaxis label="Time (h)" values = (0 6 12 18 24 30 36 42 48) TICKSTYLE=INSIDE offsetmin=0.05
fitpolicy=rotate valueattrs=(family="Times New Roman" size=9) labelattrs=(family="Times New Roman" size=9);*valuesformat=vissc_.;*;
run;
Thanks