BookmarkSubscribeRSS Feed
csa
Obsidian | Level 7 csa
Obsidian | Level 7

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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 0 replies
  • 28 views
  • 0 likes
  • 1 in conversation