<?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: sgplot - discreteorder and notsorted format in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/sgplot-discreteorder-and-notsorted-format/m-p/585734#M18803</link>
    <description>&lt;P&gt;Please try the below code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
    value sexn (notsorted) 2='Male'
                           1='Female';
run;

data class;
set sashelp.class;
if sex='M' then sexn=2;
else if sex='F' then sexn=1;
run;


proc sgplot data=class;
    vbar sexn / missing  ;
    
    xaxis discreteorder=formatted;
    format sexn sexn.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 03 Sep 2019 09:37:15 GMT</pubDate>
    <dc:creator>Jagadishkatam</dc:creator>
    <dc:date>2019-09-03T09:37:15Z</dc:date>
    <item>
      <title>sgplot - discreteorder and notsorted format</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/sgplot-discreteorder-and-notsorted-format/m-p/585718#M18802</link>
      <description>&lt;P&gt;This kind of code allows to list Male before Female in a proc means&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.class out=class;
   by sex;
run;

proc format;
    value $sex (notsorted) 'M'='Male'
                           'F'='Female';
run;

proc means data=class;
    class sex / preloadfmt order=data;
    var height;
    format sex $sex.;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But as there is currently no &lt;CODE class=" language-sas"&gt;preloadfmt&lt;/CODE&gt; options with the xaxis statement, the following code has no effect on the result&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods graphics / width=15cm height=10cm;

proc sgplot data=class;
    vbar sex / missing;
    
    xaxis discreteorder=data;*formatted;
    format sex $sex.;
run;

ods graphics off;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I know other ways to modify the order of the discrete values in the axis (vbarparm, xaxis values(), etc) but I would just like to know if it would work with vbar in a future SAS release.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2019 19:08:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/sgplot-discreteorder-and-notsorted-format/m-p/585718#M18802</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2019-09-03T19:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: sgplot - discreteorder and notsorted format</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/sgplot-discreteorder-and-notsorted-format/m-p/585734#M18803</link>
      <description>&lt;P&gt;Please try the below code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
    value sexn (notsorted) 2='Male'
                           1='Female';
run;

data class;
set sashelp.class;
if sex='M' then sexn=2;
else if sex='F' then sexn=1;
run;


proc sgplot data=class;
    vbar sexn / missing  ;
    
    xaxis discreteorder=formatted;
    format sexn sexn.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Sep 2019 09:37:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/sgplot-discreteorder-and-notsorted-format/m-p/585734#M18803</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-09-03T09:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: sgplot - discreteorder and notsorted format</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/sgplot-discreteorder-and-notsorted-format/m-p/585764#M18807</link>
      <description>Have you tried it? Female are still before Male in your example.</description>
      <pubDate>Tue, 03 Sep 2019 11:12:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/sgplot-discreteorder-and-notsorted-format/m-p/585764#M18807</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2019-09-03T11:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: sgplot - discreteorder and notsorted format</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/sgplot-discreteorder-and-notsorted-format/m-p/585767#M18808</link>
      <description>&lt;P&gt;oh ok, i thought you want female before male, if you want male before female then the code you posted is fine. I updated my code to generate the male before female&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
    value sexn (notsorted) 1='Male'
                           2='Female';
run;

data class;
set sashelp.class;
if sex='M' then sexn=1;
else if sex='F' then sexn=2;
run;


proc sgplot data=class;
    vbar sexn / missing  ;
    
    xaxis discreteorder=formatted;
    format sexn sexn.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Sep 2019 11:17:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/sgplot-discreteorder-and-notsorted-format/m-p/585767#M18808</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-09-03T11:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: sgplot - discreteorder and notsorted format</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/sgplot-discreteorder-and-notsorted-format/m-p/585768#M18809</link>
      <description>Please try your code first and you will see that Female are still before Male.</description>
      <pubDate>Tue, 03 Sep 2019 11:19:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/sgplot-discreteorder-and-notsorted-format/m-p/585768#M18809</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2019-09-03T11:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: sgplot - discreteorder and notsorted format</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/sgplot-discreteorder-and-notsorted-format/m-p/585769#M18810</link>
      <description>&lt;P&gt;Oh yeah, check this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=class;
    vbar sexn / missing  ;
    
    xaxis discreteorder=data;
    format sexn sexn.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Sep 2019 11:22:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/sgplot-discreteorder-and-notsorted-format/m-p/585769#M18810</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-09-03T11:22:54Z</dc:date>
    </item>
    <item>
      <title>Re: sgplot - discreteorder and notsorted format</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/sgplot-discreteorder-and-notsorted-format/m-p/585771#M18811</link>
      <description>Yes it works when we recode data. There are even faster ways using values=('M' 'F' ' ') in the xaxis statement. But my question was not to find an alternative solution. My question was : "I know other ways to modify the order of the discrete values in the axis but I would just like to ensure that my assumption is correct and that potentially it would work in a future SAS release."</description>
      <pubDate>Tue, 03 Sep 2019 11:27:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/sgplot-discreteorder-and-notsorted-format/m-p/585771#M18811</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2019-09-03T11:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: sgplot - discreteorder and notsorted format</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/sgplot-discreteorder-and-notsorted-format/m-p/585792#M18812</link>
      <description>&lt;P&gt;How about this one ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.class out=class;
   by sex;
run;

proc format;
    value $sex  'M'='    Male'
                'F'='Female';
run;


proc sgplot data=class;
    vbar sex / missing;
        format sex $sex.;
xaxis discreteorder=formatted ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Sep 2019 12:39:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/sgplot-discreteorder-and-notsorted-format/m-p/585792#M18812</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-09-03T12:39:12Z</dc:date>
    </item>
  </channel>
</rss>

