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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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