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 2024

innovate-wordmarks-white-horiz.png

SAS is headed back to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team.

Interested in speaking? Content from our attendees is one of the reasons that makes SAS Innovate such a special event!

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 1 reply
  • 808 views
  • 2 likes
  • 2 in conversation