The SAS Output Delivery System and reporting techniques

Can a ROWAXIS label be wrapped?

Occasional Contributor
Posts: 18

Can a ROWAXIS label be wrapped?

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 '  ';


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).


Posts: 8,744

Re: Can a ROWAXIS label be wrapped?


  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,

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.


Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation