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

I am trying to create a plot via PROC SGPLOT. The variable on the Y-axis has a very long label, which SAS splits to make it fit. I want to control where the split happens, rather than let SAS control the split. The ODS ESCAPECHAR and `{newline 1} in the code produces a message in the log that I can't do it that way. Is there some other way I can cause this label to be split where I want it to be split?

 

1262  ods escapechar = '`';
1263  ods pdf file="&pers\test.pdf";
NOTE: Writing ODS PDF output to DISK destination "g:\MillerP\test.pdf", printer "PDF".
1264  proc sgplot data=sashelp.class;
1265      scatter x=height y=weight;
1266      yaxis label='This is a very long label `{newline 1} that is probably too long';
1267  run;

NOTE: PROCEDURE SGPLOT used (Total process time):
      real time           0.72 seconds
      cpu time            0.34 seconds

NEWLINE FUNCTION NOT DEFINED IN THIS TAGSET
NEWLINE FUNCTION NOT DEFINED IN THIS TAGSET
NOTE: There were 19 observations read from the data set SASHELP.CLASS.

1268  ods pdf close;

This produces the following plot where the label is split where SAS wants to split it and not where I want to split it.

PaigeMiller_0-1659452207698.png

 

--
Paige Miller
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Perhaps:

proc sgplot data=sashelp.class;
    scatter x=height y=weight;
    yaxis label="This is a very long label (*ESC*){unicode '000A'x} that is probably too long";
run;

000A is linefeed, so might be OS and or file dependent. Did not test with PDF

View solution in original post

1 REPLY 1
ballardw
Super User

Perhaps:

proc sgplot data=sashelp.class;
    scatter x=height y=weight;
    yaxis label="This is a very long label (*ESC*){unicode '000A'x} that is probably too long";
run;

000A is linefeed, so might be OS and or file dependent. Did not test with PDF

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 1 reply
  • 3156 views
  • 2 likes
  • 2 in conversation