BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DavidPhillips2
Rhodochrosite | Level 12

I have an independent legend created from a series plot using the code below.   The legend is functional however it is a larger than I would like.  Ideally I would like to make the image smaller by word wrapping the yaxis = y2 section.  Even more ideal would be to be able to control where the word wrap occurs. 

SGRender2.png

proc template;

  define statgraph order;

  dynamic TITLE1 TITLE2;

  begingraph;

       entrytitle TITLE1;

       entrytitle TITLE2;

       layout overlay / xaxisopts =(display = NONE) yaxisopts = (display = NONE) border=false

       y2axisopts = (  reverse = true label = " "

       linearopts= ( tickvaluesequence=(start=1 end=32 increment=1)));

       seriesplot x=xax y= &Student_or_Degree_Level / yaxis = y2 display = all group=&Student_or_Degree_Level

       index = index lineattrs = (pattern =1 thickness = 1);

       endlayout;

  endgraph;

  end;

run;

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

With ODS graphics questions it is a good idea to include which version of SAS you are running as there have been significant changes in each version and a recommendation based on 9.4 may not help if you are running 9.2. Also your final desired output destination such as HTML, PDF or RTF may affect the outcome.

It may be as simple as having a format a format for your &student_or_degree_level variable that has display values that include \n such as:

proc format;

/* 1 below is just used for an example, use your values of course*/

value mylabel

1 = "Professional Practice \n (first professional)"

;

run;

and in the SGRender code have a format statement associating the variable with the label format.

View solution in original post

3 REPLIES 3
ballardw
Super User

With ODS graphics questions it is a good idea to include which version of SAS you are running as there have been significant changes in each version and a recommendation based on 9.4 may not help if you are running 9.2. Also your final desired output destination such as HTML, PDF or RTF may affect the outcome.

It may be as simple as having a format a format for your &student_or_degree_level variable that has display values that include \n such as:

proc format;

/* 1 below is just used for an example, use your values of course*/

value mylabel

1 = "Professional Practice \n (first professional)"

;

run;

and in the SGRender code have a format statement associating the variable with the label format.

Jay54
Meteorite | Level 14

With SAS 9.4 GTL, you can use TickValueFitPolicy in DiscreteOpts with the Y2AxisOpts to wrap the text.  You can use specific split characters if you want to control where the split occurs.

DavidPhillips2
Rhodochrosite | Level 12

I am using SAS 9.2.   Ballardw your example using proc format with \n should solve what I need.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 3 replies
  • 1256 views
  • 3 likes
  • 3 in conversation