I applied format for response variable when create the hbar plot with segment label.
But, some segments widths are so narrow, then format didn't work.
Here is the plot.
Actually brown colored segment should be print as "L". Also, the real value of brown colored segment is 2.778.
But with below code, the segment is printed out as "3" not "L".
I think the reason why this problems has happened because of segment width is so narrow.
How can I print brown colored segment with formatted letter?
Thanks.
ods graphics / reset width=12in height=6in imagename='full';
proc sgplot data=graph ;
format score fmtv. ;
hbar site / response=score group=risk_num seglabel seglabelattrs=(size=10 weight=bold) ;
yaxis grid discreteorder=data display=(nolabel) valueattrs=(size=12);
xaxis values=(0 10 20 30 40 50 60 ) valuesdisplay=("0" "10" "20" "30" "40" "50" "60") label="Total Risk Score" labelattrs=(size=11) valueattrs=(weight=bold size=11) ;
refline &all_mean / axis=x lineattrs=(color=red thickness=3) label='[Overall Mean:&all_mean]' labelattrs=(weight=bold size=11) labelpos=min labelloc=outside; ;
discretelegend / title="" position=bottom valueattrs=(size=12) noborder ;
run;
ods graphics / reset=width;
Add SEGLABELFITPOLICY=NONE to the HBAR options. By default, the fit policy is to "thin" the labels that don't fit in the bars.
Add SEGLABELFITPOLICY=NONE to the HBAR options. By default, the fit policy is to "thin" the labels that don't fit in the bars.
Thanks for your comment. It's very helpful.
Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.
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.
Ready to level-up your skills? Choose your own adventure.