BookmarkSubscribeRSS Feed
BruceBrad
Lapis Lazuli | Level 10

Can I wrap legend text in sgplot? I have long legend labels and I would like them to wrap so that the legend box can be tall and thin rather than short and wide.

3 REPLIES 3
djrisks
Barite | Level 11

Hi Bruce, you can use the ACROSS and DOWN options in the KEYLEGEND statement to control how the legend looks. Does this help?

Jay54
Meteorite | Level 14

I do not know of a way to wrap the legend text, and it would be a complicated layout to do this.  Legends layouts can get tricky.  Also, the benefit of such wrapping to create tall and narrow legend is not clear.  If you have long legend text, I suggest you use ACROSS=1 and place the legend at the bottom of the graph.  

BruceBrad
Lapis Lazuli | Level 10

Unfortunately these methods won't provide what I want. I find tall and thin legends positioned to the right of the plot area are a good way of identifying multiple line series. This way, as well as identifying by colour and pattern, the series can also be identified by position (the top series first in the legend and so on).

 

With proc tabulate we can specify break characters in the formated values - but I presume this won't work in legends.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1399 views
  • 0 likes
  • 3 in conversation