<?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: Change bar ordering - sgrender in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Change-bar-ordering-sgrender/m-p/826453#M23044</link>
    <description>&lt;P&gt;Display order of categorical variables is quite often as the order seen by the graphing procedure. Exceptions would be actual numerical axis variables with an axis that expects numerical order.&lt;/P&gt;
&lt;P&gt;So sorting by the group and subgroup variables prior to graphing often addresses such issues. Proc sort does allow descending order mixed with ascending per variable if that helps.&lt;/P&gt;</description>
    <pubDate>Mon, 01 Aug 2022 14:53:46 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-08-01T14:53:46Z</dc:date>
    <item>
      <title>Change bar ordering - sgrender</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Change-bar-ordering-sgrender/m-p/826420#M23043</link>
      <description>&lt;P&gt;Hi, its me again,&lt;/P&gt;&lt;P&gt;I have a maybe very easy question:&lt;/P&gt;&lt;P&gt;How do I change the order or my bars in the grouped bar chart of sgrender??&lt;/P&gt;&lt;P&gt;I want it in the swapped order (shown below in red) and not in the order of my x=n.&lt;/P&gt;&lt;P&gt;How can do this?&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="test.PNG" style="width: 200px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73969i54858AE7906E7C3C/image-size/small?v=v2&amp;amp;px=200" role="button" title="test.PNG" alt="test.PNG" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;My used code is below.&lt;/P&gt;&lt;P&gt;Thanks in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;proc format;
   value xvarf
     1 = '1'
     2 = '2'
     3 = '3'
     4 = '4';
   value groupf
     1 = '1'
     2 = '2';
run;

data eyeIrritation;
   attrib param length=$100 label='PARAMETER';
   attrib percent length=8 label='Percentage';
   attrib time length=3 format=XVARF.;
   attrib chartvar length=3 label='Treatment group:' format=GROUPF.;
   attrib lcl length=8 label='Lower confidential limit';
   attrib ucl length=8 label='Upper confidential limit';
   attrib n length=8 label='Number of subjects';
   attrib m length=8 label=' of subjects';
   infile datalines dsd;
   input param percent time chartvar lcl ucl n m;
   datalines4;
Beratung, 41.7261905, 1, 1, 35.2002330, 48.2521479, 42, 1
Beratung, 38.3783784, 1, 2,31.0899430,45.6668138,37, 2
Beratung, 37.6785714, 2, 1,28.7006360,46.6565069,28, 3
Beratung, 35.0869565, 2, 2,24.6303204,45.5435926,23, 4

;;;;

title;
proc template;
   define style styles.blue;
      parent = styles.default;
      class GraphColors
         "Abstract colors used in graph styles" /
         'gdata'  = cxaFb3cF
         'gdata3' = cx8CaEdF
         'gdata2' = cx5A96DE
         'gdata1' = cx42659C;
      style color_list from color_list
         "Abstract colors used in graph styles" /
         'bgA'   = cxe0e7e7; 
   end;
run;

proc template;
  define statgraph EyeIrritation;
    begingraph / datacolors=(CX87CEFA CXE0FFFF );
    entrytitle 'Distribution of Eye Irritation (Redness)';
    entryfootnote halign=left 'X Axis shows the number of subjects by treatment for each week';
    layout gridded / border=false;
      layout datalattice columnvar=time / headerlabeldisplay=value cellwidthmin=50
             columnheaders=bottom border=false columndatarange=union
             columnaxisopts=(display=(line tickvalues))
             rowaxisopts=(offsetmin=0 linearopts=(viewmax=60 tickvaluepriority=true )
             label='% Subjects' griddisplay=on);
        layout prototype / walldisplay=(fill);
          barchart x=n y=percent / group=chartvar name='a' barlabel=true skin=modern
                                   outlineattrs=(color=black);
          scatterplot x=n y=percent / yerrorlower=lcl yerrorupper=ucl markerattrs=(size=0)
                                      errorbarattrs=(thickness=1.5 color=black) datatransparency=0.6;
        endlayout;
      endlayout;
      entry ' ';
      discretelegend 'a' / title=' '  border=false ;
    endlayout;
  endgraph;
end;
run;

ods listing close;
ods html style=styles.blue image_dpi=100 file='EyeIrritation.html' path='.';
ods graphics / reset noborder width=600px height=400px
               imagename='EyeIrritation' imagefmt=gif noscale;

proc sgrender data=eyeIrritation template=EyeIrritation;
   format percent 5.1;
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Aug 2022 12:11:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Change-bar-ordering-sgrender/m-p/826420#M23043</guid>
      <dc:creator>Lattecoffeegirl</dc:creator>
      <dc:date>2022-08-01T12:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: Change bar ordering - sgrender</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Change-bar-ordering-sgrender/m-p/826453#M23044</link>
      <description>&lt;P&gt;Display order of categorical variables is quite often as the order seen by the graphing procedure. Exceptions would be actual numerical axis variables with an axis that expects numerical order.&lt;/P&gt;
&lt;P&gt;So sorting by the group and subgroup variables prior to graphing often addresses such issues. Proc sort does allow descending order mixed with ascending per variable if that helps.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2022 14:53:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Change-bar-ordering-sgrender/m-p/826453#M23044</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-08-01T14:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: Change bar ordering - sgrender</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Change-bar-ordering-sgrender/m-p/826458#M23046</link>
      <description>&lt;P&gt;For this plot, the easiest way is to set REVERSE=TRUE in the COLUMNAXISOPTS options.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2022 15:26:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Change-bar-ordering-sgrender/m-p/826458#M23046</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2022-08-01T15:26:18Z</dc:date>
    </item>
  </channel>
</rss>

