BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
shoh
Calcite | Level 5

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.  

 

 

image.png

 

 

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;

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Add SEGLABELFITPOLICY=NONE to the HBAR options.  By default, the fit policy is to "thin" the labels that don't fit in the bars.

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ

Add SEGLABELFITPOLICY=NONE to the HBAR options.  By default, the fit policy is to "thin" the labels that don't fit in the bars.

shoh
Calcite | Level 5

Thanks for your comment. It's very helpful. 

sas-innovate-white.png

Missed SAS Innovate in Orlando?

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.

 

Register now

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
  • 2 replies
  • 1496 views
  • 1 like
  • 2 in conversation