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

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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