<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SGPANEL can I wrap a formatted x-axis? in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/SGPANEL-can-I-wrap-a-formatted-x-axis/m-p/653016#M20003</link>
    <description>&lt;P&gt;The issue I was seeing is that your "column axis labels" are actually the panel headers from the panelby statement and these are not affected by COLAXIS as far as I know.&amp;nbsp; I noticed that your TRTP variable was all the same value, so I changed your code to be an SGPLOT using the AVALN variable as the category variable instead.&amp;nbsp; This puts the values into the x-axis which are then affected by the SPLITPOLICY.&amp;nbsp; I made the graph wider as well since the labels are still squished.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
  ods graphics / width=15in;
proc sgplot data=forfig3 description="#byval1";
    format pct mypct.;
    format avaln avalfmt.;
    by dtype2;
    styleattrs datacolors=(CX008000 CXFFFF00 CXFFA500 CXFF0000 CX000000);
    vbar avaln /  response=pct stat=sum group=atoxgrn barwidth=.6 clusterwidth=1 datalabel datalabelattrs=(size=7 family=arial) ;
    xaxis fitpolicy=splitalways splitchar="*" label='Month' labelpos=left labelattrs=(size=9 family=arial);
    yaxis grid min=0 max=100 offsetmin=.01 offsetmax=.01 values=(0 to 75 by 25) labelattrs=(size=10 family=arial) valuesformat=best4.0 valueattrs=(size=8 family=arial) Label="Percent";
    keylegend / noborder titleattrs=(size=9 family=arial) position=bottom title='Maximum Grade';
  run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SGPlot1.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/40330i5CEE4FAA214BF74C/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPlot1.png" alt="SGPlot1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jun 2020 21:44:18 GMT</pubDate>
    <dc:creator>JeffMeyers</dc:creator>
    <dc:date>2020-06-03T21:44:18Z</dc:date>
    <item>
      <title>SGPANEL can I wrap a formatted x-axis?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPANEL-can-I-wrap-a-formatted-x-axis/m-p/648908#M19929</link>
      <description>&lt;P&gt;I am creating a panel plot of AE's by grade over time using SGPANEL (9.4 M5). Truth is, I have no idea what I am doing, but thanks to so many wonderful people sharing their wisdom I've got a decent graph.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to add the denominator to the x-axis, as the N's change over time. I've tried COLAXISTABLE, but the bars are a sum of AE grades and I only want the denominator to display once (versus multiple times for each grade).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my borrowing of code, I found this: &lt;A href="https://communities.sas.com/t5/Graphics-Programming/Wrap-SGPANEL-Column-Headers-9-3/td-p/416411" target="_blank"&gt;https://communities.sas.com/t5/Graphics-Programming/Wrap-SGPANEL-Column-Headers-9-3/td-p/416411&lt;/A&gt; which lead me to try and format a numeric PANELBY variable. It works nicely if I display 12 months. But when I go out to say, 24 months, I can't seem to get the x-axis to wrap (e.g., month on one line and the (N=X) on a line below). I've tried inserting line breaks, but haven't had success. Any help is greatly appreciated! Code, data and example plot attached.&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2020 16:24:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPANEL-can-I-wrap-a-formatted-x-axis/m-p/648908#M19929</guid>
      <dc:creator>mcraib</dc:creator>
      <dc:date>2020-05-19T16:24:50Z</dc:date>
    </item>
    <item>
      <title>Re: SGPANEL can I wrap a formatted x-axis?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPANEL-can-I-wrap-a-formatted-x-axis/m-p/648940#M19935</link>
      <description>&lt;P&gt;Unless you have real long program it is best to post code into a code box for easy reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your format try adding a special character such as the *&lt;/P&gt;
&lt;PRE&gt;proc format;
  value avalfmt
  %macro loopit;
    %do a = 1 %to 24;
      &amp;amp;a = "&amp;amp;a *(N=&amp;amp;&amp;amp;n&amp;amp;a)"
    %end; 
  %mend loopit;
  %loopit;
  ;
run;
&lt;/PRE&gt;
&lt;P&gt;And in your sgpanel use a COLAXIS statement with the option SPLITCHAR="*" (or which ever special character you use in the format where I used the *).&lt;/P&gt;
&lt;P&gt;The Splitchar option should force a second (or even third row) axis label when the character is present in the displayed value.&lt;/P&gt;
&lt;P&gt;However you may still run into issues with the number of ticks displayed.&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2020 17:52:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPANEL-can-I-wrap-a-formatted-x-axis/m-p/648940#M19935</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-19T17:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: SGPANEL can I wrap a formatted x-axis?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPANEL-can-I-wrap-a-formatted-x-axis/m-p/650901#M19965</link>
      <description>&lt;P&gt;Thanks so much for the suggestion! I had tried that before but figured why not, I'll try it again. But sadly, it didn't work for me. Maybe I'm doing something wrong. Thanks though!&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2020 19:27:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPANEL-can-I-wrap-a-formatted-x-axis/m-p/650901#M19965</guid>
      <dc:creator>mcraib</dc:creator>
      <dc:date>2020-05-26T19:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: SGPANEL can I wrap a formatted x-axis?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPANEL-can-I-wrap-a-formatted-x-axis/m-p/650970#M19976</link>
      <description>&lt;P&gt;Are you also setting FITPOLICY=SPLIT on the XAXIS?&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 03:46:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPANEL-can-I-wrap-a-formatted-x-axis/m-p/650970#M19976</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2020-05-27T03:46:41Z</dc:date>
    </item>
    <item>
      <title>Re: SGPANEL can I wrap a formatted x-axis?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPANEL-can-I-wrap-a-formatted-x-axis/m-p/651139#M19980</link>
      <description>&lt;P&gt;May I start by saying what an honor it is to see a reply from the Brad Pitt of SAS graph? I guess that makes Sanjay the George Clooney? Maybe? Quarantine getting to me? Probably. In any case,&amp;nbsp;I tried it again, making sure I added that and still no dice. I'm starting to wonder if I picked the wrong means of graphing this. The example I attached is for one treatment group, but an earlier version had two bars in each panel, one for each of two treatment groups. So I felt like SGPANEL was a good fit. But really, I have no idea what I am doing! Here's my code again, adding the splitchar and fitpolicy. I had added the asterisk to the proc format as well, as suggested. Resulting figure is attached. I don't know if the issue is I have a two-level x-axis (treatment group and month) and I am using proc format so it's not recognizing the splitchar? I tried COLAXISTABLE (commented out&amp;nbsp;below) but that didn't work for me (at least as I intended), because it displayed N's for every grade level and I only wanted them once. Thanks for the help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;  proc sgpanel data=forfig3 description="#byval1";
	format pct mypct.;
    format avaln avalfmt.;
    by dtype2;
    styleattrs datacolors=(CX008000 CXFFFF00 CXFFA500 CXFF0000 CX000000);
    panelby avaln / layout=columnlattice colheaderpos=bottom novarname noborder columns=24 proportional spacing=0 uniscale=row missing noheaderborder headerattrs=(family=arial size=8);
    vbar trtp / response=pct stat=sum group=atoxgrn barwidth=.6 clusterwidth=1 datalabel datalabelattrs=(size=7 family=arial) ;
    colaxis fitpolicy=split splitchar="*" display=(novalues noticks) label='Month' labelpos=left labelattrs=(size=9 family=arial);
    * the colaxistable is not working so well bc it wants to plot Ns for all levels of ATOXGRN, will instead add Ns to AVAL *;
    *colaxistable denom / nomissingchar nomissingclass valueattrs=(color=blue);
    rowaxis grid min=0 max=100 offsetmin=.01 offsetmax=.01 values=(0 to 75 by 25) labelattrs=(size=10 family=arial) valuesformat=best4.0 valueattrs=(size=8 family=arial) Label="Percent";
    keylegend / noborder titleattrs=(size=9 family=arial) position=bottom title='Maximum Grade';
  run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 16:58:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPANEL-can-I-wrap-a-formatted-x-axis/m-p/651139#M19980</guid>
      <dc:creator>mcraib</dc:creator>
      <dc:date>2020-05-27T16:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: SGPANEL can I wrap a formatted x-axis?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPANEL-can-I-wrap-a-formatted-x-axis/m-p/653016#M20003</link>
      <description>&lt;P&gt;The issue I was seeing is that your "column axis labels" are actually the panel headers from the panelby statement and these are not affected by COLAXIS as far as I know.&amp;nbsp; I noticed that your TRTP variable was all the same value, so I changed your code to be an SGPLOT using the AVALN variable as the category variable instead.&amp;nbsp; This puts the values into the x-axis which are then affected by the SPLITPOLICY.&amp;nbsp; I made the graph wider as well since the labels are still squished.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
  ods graphics / width=15in;
proc sgplot data=forfig3 description="#byval1";
    format pct mypct.;
    format avaln avalfmt.;
    by dtype2;
    styleattrs datacolors=(CX008000 CXFFFF00 CXFFA500 CXFF0000 CX000000);
    vbar avaln /  response=pct stat=sum group=atoxgrn barwidth=.6 clusterwidth=1 datalabel datalabelattrs=(size=7 family=arial) ;
    xaxis fitpolicy=splitalways splitchar="*" label='Month' labelpos=left labelattrs=(size=9 family=arial);
    yaxis grid min=0 max=100 offsetmin=.01 offsetmax=.01 values=(0 to 75 by 25) labelattrs=(size=10 family=arial) valuesformat=best4.0 valueattrs=(size=8 family=arial) Label="Percent";
    keylegend / noborder titleattrs=(size=9 family=arial) position=bottom title='Maximum Grade';
  run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="SGPlot1.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/40330i5CEE4FAA214BF74C/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPlot1.png" alt="SGPlot1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 21:44:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPANEL-can-I-wrap-a-formatted-x-axis/m-p/653016#M20003</guid>
      <dc:creator>JeffMeyers</dc:creator>
      <dc:date>2020-06-03T21:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: SGPANEL can I wrap a formatted x-axis?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPANEL-can-I-wrap-a-formatted-x-axis/m-p/654613#M20022</link>
      <description>&lt;P&gt;Thanks!!! That worked. Very cool. Is it possible to&amp;nbsp;use&amp;nbsp;this method (SGPLOT) to accommodate 2 treatment groups side by side at each month? My first iteration of this graph went out 12 months and had 2 groups (drug/placebo). I was then asked to run the same graph on a different group (all treated). I'd love to have code that could work in either situation (1&amp;nbsp;vs&amp;nbsp;&amp;gt;1 treatment groups). Thank you so much!&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 17:09:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPANEL-can-I-wrap-a-formatted-x-axis/m-p/654613#M20022</guid>
      <dc:creator>mcraib</dc:creator>
      <dc:date>2020-06-08T17:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: SGPANEL can I wrap a formatted x-axis?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPANEL-can-I-wrap-a-formatted-x-axis/m-p/656512#M20023</link>
      <description>&lt;P&gt;How do you want the different groups shown?&amp;nbsp; In different panels, with bars next to each other, or some other way?&amp;nbsp; If it's in different panels then you could use your treatment variable in your PANELBY statement in SGPANEL and try similar code to make 2 or more different groups.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 18:39:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPANEL-can-I-wrap-a-formatted-x-axis/m-p/656512#M20023</guid>
      <dc:creator>JeffMeyers</dc:creator>
      <dc:date>2020-06-10T18:39:15Z</dc:date>
    </item>
  </channel>
</rss>

