BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
SamR
Fluorite | Level 6

I am having a recurring issue where labels are frequently truncating in legends in both SGPANEL and SGPLOT. There is plenty of room for the labels so I have no idea why this is happening.

 

Example code below:

 

options orientation=landscape;
ods escapechar='~';
ods graphics on /width = 9in height =4in noborder; 

ods rtf file="&output.\&Tfloutput..rtf" style=rtfdef startpage=yes nogfootnote nogtitle;

proc sgpanel data=final;
  by paramn param;
  panelby mct / columns=1 rows=4;
  hbar trt01pn / response=rowpercent group=respn name="plot" ;
  colaxis label='Percent of Total Frequency';
  rowaxis label=' ' type=discrete reverse;
  keylegend "plot"/ title="Status";
  format trt01pn trt. respn resp.;
run;

ods rtf close;

Screen shot of truncated legend label below. Even if I use across to do one label per line in the legend it still truncates. Any suggestions of a fix?

Screenshot 2026-02-24 145932.png 

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

Do you get the same behavior if you add OUTPUTFMT=PNG to the ODS GRAPHICS statement in your program?

View solution in original post

9 REPLIES 9
PaigeMiller
Diamond | Level 26

I had this same problem, it happened when the version of SAS Studio in SAS Viya changed. The default fonts changed, the default style changed and I saw the exact same truncation of labels that you are seeing. The solution is quoted below, verbatim, that my local support people received from SAS.

 

This is a known issue with newer versions of SAS Studio due to a change that R&D made. By default, newer versions of SAS Studio use the following new ODS style:
Light2025
I can easily recreate this issue here. The issue is due to the default style that SAS uses when using newer versions of SAS Viya.
To see if this circumvents the issue, please do the following.
When in a SAS Studio/SAS Viya session, click the "login" icon in the upper-right hand corner of the SAS Studio window. This is the icon just to the right of the question mark ("?") icon.
Then, choose:
Settings
Under:
SAS Programs
Select:
Results
On the right-hand side, enable the following option:
Specify an HTML output style
And for the style, choose a style such as:
HTMLBlue
Or:
HTMLEncore
Then click:
Close

--
Paige Miller
DanH_sas
SAS Super FREQ

For the record, the font issue described by @PaigeMiller has been addressed. The newer styles such as Light2025 should no longer have the truncation issue.

PaigeMiller
Diamond | Level 26

@DanH_sas wrote:

For the record, the font issue described by @PaigeMiller has been addressed. The newer styles such as Light2025 should no longer have the truncation issue.


Good to know. Thanks, @DanH_sas !

--
Paige Miller
DanH_sas
SAS Super FREQ

Can you show more of the graph area containing the legend to give a little more context?

SamR
Fluorite | Level 6

Sure. Here you go.

graph.png

DanH_sas
SAS Super FREQ

Are you using SAS Viya 4? If so, what version?

SamR
Fluorite | Level 6

No not SAS Viya. Just standard DMS 9.4

DanH_sas
SAS Super FREQ

Do you get the same behavior if you add OUTPUTFMT=PNG to the ODS GRAPHICS statement in your program?

SamR
Fluorite | Level 6

No!! This fixes it! This has been driving me mad for ages so many thanks!

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore 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
  • 9 replies
  • 890 views
  • 3 likes
  • 3 in conversation