<?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: how to arrange the bars in alphabetical order in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-arrange-the-bars-in-alphabetical-order/m-p/609179#M177350</link>
    <description>&lt;P&gt;Alphabetical order of which variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Dec 2019 21:13:09 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-12-03T21:13:09Z</dc:date>
    <item>
      <title>how to arrange the bars in alphabetical order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-arrange-the-bars-in-alphabetical-order/m-p/609162#M177341</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;How to change the order of vertical bars as requested by the question below?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;B. How would you rewrite the cont format to arrange the bars in alphabetical order? You could accomplish this by using a chart statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data demog;
  input id contry $ 5-17 pop 19-22 pcturb 24-25 energy 27-29 cult 31-32 
        pasture 34-35 forest 37-38;
cards;
101 China         1062 32  19 11 30 14
107 Japan          122 76 111 13  2 68
113 Philippines     62 40   9 38  4 40
102 India          800 25   7 51  4 21
112 Vietnam         62 19   4 20  1 40
109 Bangladesh     107  .   .  .  .  .
105 Indonesia      175  .   .  .  .  .
110 Paskistan      105 28   6 25  6  4
304 United States  243 74 280 20 26 28
311 Mexico          82 70  50 13 38 23
406 Brazil         141 71  19  9 19 66
508 Nigeria        109 28   7 34 23 16
603 USSR           284 65 176 10 17 42
614 West Germany    61 85 163 30 19 29
615 Italy           57 72  90 41 16 21
;
proc print;
run;

proc format;
value cont   100-199='Asia'        200-299='Australasia'
             300-399='N. America'  400-499='S. America'
             500-599='Africa'      600-699='Europe';
run;

data demog1;
FORMAT id cont.;
set demog;
rename id=cont;
TITLE '5a. Recode country number as continent name';
proc print; run;


proc chart data=demog1;
vbar energy/group=cont subgroup=contry discrete
SUMVAR=energy type=mean;
title '5a. Chart with format';
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 20:33:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-arrange-the-bars-in-alphabetical-order/m-p/609162#M177341</guid>
      <dc:creator>Amy0223</dc:creator>
      <dc:date>2019-12-03T20:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to arrange the bars in alphabetical order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-arrange-the-bars-in-alphabetical-order/m-p/609164#M177342</link>
      <description>You should use SGPLOT instead. Then you can specify order=data to get the order you want. &lt;BR /&gt;&lt;BR /&gt;In general, SG graphics are easier to control and have better quality graphs as well. GCHART/CHART are very old procedures and you shouldn't be developing new graphs with those IMO.</description>
      <pubDate>Tue, 03 Dec 2019 20:36:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-arrange-the-bars-in-alphabetical-order/m-p/609164#M177342</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-12-03T20:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to arrange the bars in alphabetical order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-arrange-the-bars-in-alphabetical-order/m-p/609167#M177344</link>
      <description>Thank you for the information. I learned something new! The question given by my instructor required us to use a chart statement so I did it this way. Do you know how to change the order given the data provided? I greatly appreciate your response!</description>
      <pubDate>Tue, 03 Dec 2019 20:42:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-arrange-the-bars-in-alphabetical-order/m-p/609167#M177344</guid>
      <dc:creator>Amy0223</dc:creator>
      <dc:date>2019-12-03T20:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to arrange the bars in alphabetical order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-arrange-the-bars-in-alphabetical-order/m-p/609171#M177345</link>
      <description>No instructor should be teaching a CHART statement these days. &lt;BR /&gt;&lt;BR /&gt;Sorry, no I don't know the CHART procedure, I know the SG procedures.</description>
      <pubDate>Tue, 03 Dec 2019 20:46:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-arrange-the-bars-in-alphabetical-order/m-p/609171#M177345</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-12-03T20:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to arrange the bars in alphabetical order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-arrange-the-bars-in-alphabetical-order/m-p/609172#M177346</link>
      <description>Ok, thank you for taking time!</description>
      <pubDate>Tue, 03 Dec 2019 20:48:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-arrange-the-bars-in-alphabetical-order/m-p/609172#M177346</guid>
      <dc:creator>Amy0223</dc:creator>
      <dc:date>2019-12-03T20:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: how to arrange the bars in alphabetical order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-arrange-the-bars-in-alphabetical-order/m-p/609179#M177350</link>
      <description>&lt;P&gt;Alphabetical order of which variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 21:13:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-arrange-the-bars-in-alphabetical-order/m-p/609179#M177350</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-12-03T21:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to arrange the bars in alphabetical order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-arrange-the-bars-in-alphabetical-order/m-p/609180#M177351</link>
      <description>I think it means cont variable. Thanks!</description>
      <pubDate>Tue, 03 Dec 2019 21:14:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-arrange-the-bars-in-alphabetical-order/m-p/609180#M177351</guid>
      <dc:creator>Amy0223</dc:creator>
      <dc:date>2019-12-03T21:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to arrange the bars in alphabetical order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-arrange-the-bars-in-alphabetical-order/m-p/609198#M177357</link>
      <description>&lt;P&gt;I haven't seen anyone actually proc CHART since about 1987 as the Text Based graphic procedures have gone way out of style.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I recall correctly the horizontal axis uses the mid point of a numerical value then applies the format as the value.&lt;/P&gt;
&lt;P&gt;So if the goal is to get things in order you need to create a new character variable that will sort itself by default.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data work.demog1;
FORMAT id cont.;
set work.demog;
rename id=cont;
   conttext = put(id,cont.);
run;
TITLE '5a. Recode country number as continent name';



proc chart data=work.demog1;
vbar energy/group=conttext subgroup=contry discrete
SUMVAR=energy type=mean;
title '5a. Chart with format';
run;  title;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Dec 2019 21:54:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-arrange-the-bars-in-alphabetical-order/m-p/609198#M177357</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-12-03T21:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to arrange the bars in alphabetical order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-arrange-the-bars-in-alphabetical-order/m-p/609203#M177358</link>
      <description>Amazing! Thank you so much!! I don't know why we had to use proc CHART but it works!</description>
      <pubDate>Tue, 03 Dec 2019 22:55:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-arrange-the-bars-in-alphabetical-order/m-p/609203#M177358</guid>
      <dc:creator>Amy0223</dc:creator>
      <dc:date>2019-12-03T22:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to arrange the bars in alphabetical order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-arrange-the-bars-in-alphabetical-order/m-p/609213#M177359</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265801"&gt;@Amy0223&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Amazing! Thank you so much!! I don't know why we had to use proc CHART but it works!&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Is this for a class? It may be that the teacher just hasn't bothered to update examples or is going to add in the "prettier" graphs later.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Text based graphics, while not very pretty are portable across operating systems. if you can generate a text file then you get the output. That was not the case in the older SAS/Graph procedures such as GChart and GPlot that had device based output. So a teacher may keep older things floating around to avoid having to get into device drivers and such.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 00:04:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-arrange-the-bars-in-alphabetical-order/m-p/609213#M177359</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-12-04T00:04:49Z</dc:date>
    </item>
  </channel>
</rss>

