BookmarkSubscribeRSS Feed
jsberger
Obsidian | Level 7

I've got code in place for a panel plot where everything is working as i wish, however i would like to have a y-axis label that is too long for the size of the graph.  I'd like to be able to 'wrap' the label down to a second line, and i thought i could accomplish this via escapechar, but this doesn't seem to be working.  Is it not possible to use escapechar in this manner to create a new line?

ods listing close;

ods escapechar="^";

ods listing style=styles.diss_style;

ods graphics/reset imagename="figure1" border=off /*height= width=8.0 in*/ scale=on ;

proc sgpanel data=n1_n2_tau1 ;

  panelby n1/columns=5 spacing=15;

  vline n2/response=fe_power_l1_tau10 stat=mean lineattrs=(color=black pattern=solid) legendlabel="Level-1/tau1=0.0"; /*i've removed some vline references for simplicity*/

  rowaxis values=(0 to 1 by 0.1);

  refline 0.8/axis=y lineattrs=(color=black pattern=dash);

  label fe_power_l1_tau10="Statistical Power of Fixed Effect ^n Parameter Estimates" n2='Level-2 Sample Size';

  keylegend / across=2 down=2;

  format n1 n1size.;

  title '  ';

  run;

ods _all_ close;

Any help or ideas is greatly appreciated.  Ideally, i'd like to be able to accomplish this using the code i have in place (without having to migrate to statgraph under proc template).

Jason

1 REPLY 1
Cynthia_sas
SAS Super FREQ


Hi:

  You might want to pose this question in the ODS GRAPHICS forum, to find out what future development plans are or whether there's a current workaround (depending on your version of SAS). However, in the documentation,

http://support.sas.com/documentation/cdl/en/odsug/62755/HTML/default/viewer.htm#p11xia2ltavr8ln17srq...

it says:

"Inline Formatting with ODS Statistical Graphics

ODS Statistical Graphics  include template-based procedures (SGPLOT, SGPANEL, and SGSCATTER) and some statements that support ODS ESCAPECHAR in conjunction with the UNICODE, SUB, and SUP inline formatting functions. Refer to SAS ODS Graphics: Procedures Guide and SAS Graph Template Language: User's Guide for information about how to use these functions with ODS Statistical Graphics. "         
 

which implies to me that the only ESCAPECHAR functions that you can use are the ones that are mentioned in that paragraph. The "new" syntax for inserting a line feed into TABULAR output is ^{newline 1} -- instead of ^n, as you show. But I tried ^{newline 1} and it doesn't work in the Axis label either.

  If you search the "Graphically Speaking" blog by Sanjay@sas, you will find a post (on May 25, 2012) about splitting the X axis tick values. Not exactly what you were asking, but he does discuss an interesting feature that's coming for 9.4 to TickValueFitPolicy called "SplitAlways".  I don't know whether they have implemented anything similar for the axis labels or not.

  There may be a way to annotate more lines of text onto the image (in place of the AXIS label), since ESCAPECHAR methods don't seem to work. You'd have to work with Tech Support to find out for sure. ANNOTATE with ODS GRAPHICS works very similar to ANNOTATE with "classic" SAS/GRAPH. The advantage of an ANNOTATE approach, it that it would leave your present approach intact but might add the ability to annotate your label text as 2 lines instead of 1. Either reposting your question in the ODS GRAPHICS forum or working with Tech Support would be your best bet for help.

cynthia

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