<?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 Change the x-axis order in GPLOT in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Change-the-x-axis-order-in-GPLOT/m-p/556253#M9787</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to get the total_roots distribution by&amp;nbsp; account_range,like pic below, but the x-axis order is not what I want.&amp;nbsp; thanks a lot for help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;my data looks like below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Obs versiontype           account_num      roots           account_range 
1  ads                      2                1                  0-100 
2  ads                      3                1                  0-100 
3  user_define              3                1                  0-100 
4  user_define              4                1                  0-100 
5  customized               7                1                  0-100 
6  ads                      8                1                  0-100 
7  customized               9                1                  0-100 
8  basic                    13               1                  0-100 
9  advanced                 15               1                  0-100 
10 advanced                 16               1                  0-100 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;main program I get the graph is below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	proc format library = library;
	value Account_Range	
				low-100='0-100'
		                101-200='101-200'
				201-300='201-300'
				301-400='301-400'
				401-500='401-500'
				501-600='501-600'
				601-700='601-700'
				701-800='701-800'
				801-900='801-900'
				901-1000='901-1000'
				1001-2000='1000-2000'
				2001-high='2001+';
	     
	run;

        data client.tmp_account_format;
             set client.tmp_account_num_roots;
             account_range = put(account_num,account_range.);
         run;

         proc sql;
              create table client.tmp_accounts as 
              select versiontype,account_range,sum(roots)as total_roots 
              from client.tmp_account_format 
              group by versiontype,account_range 
              ;
          quit;

          proc gplot data=client.tmp_accounts ;
               plot total_roots * account_range ;
               where versiontype in ('ads','basic','advanced','customized','user_define');
               by versiontype; 
         run;
         quit;&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;the result I get like below: I guess the x-axis is not well ordered is mainly because the put function converts the account_range to character, so SAS sort the account_range like below, but can I change it? move the 1001-2000 and 2000+ to the right of the chart.&lt;/P&gt;&lt;P&gt;Thanks a lot !&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29208iA41749DFC1A1E5E1/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.png" alt="2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 05 May 2019 12:06:42 GMT</pubDate>
    <dc:creator>avner</dc:creator>
    <dc:date>2019-05-05T12:06:42Z</dc:date>
    <item>
      <title>Change the x-axis order in GPLOT</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-the-x-axis-order-in-GPLOT/m-p/556253#M9787</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to get the total_roots distribution by&amp;nbsp; account_range,like pic below, but the x-axis order is not what I want.&amp;nbsp; thanks a lot for help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;my data looks like below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Obs versiontype           account_num      roots           account_range 
1  ads                      2                1                  0-100 
2  ads                      3                1                  0-100 
3  user_define              3                1                  0-100 
4  user_define              4                1                  0-100 
5  customized               7                1                  0-100 
6  ads                      8                1                  0-100 
7  customized               9                1                  0-100 
8  basic                    13               1                  0-100 
9  advanced                 15               1                  0-100 
10 advanced                 16               1                  0-100 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;main program I get the graph is below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	proc format library = library;
	value Account_Range	
				low-100='0-100'
		                101-200='101-200'
				201-300='201-300'
				301-400='301-400'
				401-500='401-500'
				501-600='501-600'
				601-700='601-700'
				701-800='701-800'
				801-900='801-900'
				901-1000='901-1000'
				1001-2000='1000-2000'
				2001-high='2001+';
	     
	run;

        data client.tmp_account_format;
             set client.tmp_account_num_roots;
             account_range = put(account_num,account_range.);
         run;

         proc sql;
              create table client.tmp_accounts as 
              select versiontype,account_range,sum(roots)as total_roots 
              from client.tmp_account_format 
              group by versiontype,account_range 
              ;
          quit;

          proc gplot data=client.tmp_accounts ;
               plot total_roots * account_range ;
               where versiontype in ('ads','basic','advanced','customized','user_define');
               by versiontype; 
         run;
         quit;&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;the result I get like below: I guess the x-axis is not well ordered is mainly because the put function converts the account_range to character, so SAS sort the account_range like below, but can I change it? move the 1001-2000 and 2000+ to the right of the chart.&lt;/P&gt;&lt;P&gt;Thanks a lot !&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29208iA41749DFC1A1E5E1/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.png" alt="2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 May 2019 12:06:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-the-x-axis-order-in-GPLOT/m-p/556253#M9787</guid>
      <dc:creator>avner</dc:creator>
      <dc:date>2019-05-05T12:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: Change the x-axis order in GPLOT</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-the-x-axis-order-in-GPLOT/m-p/556445#M9822</link>
      <description>&lt;P&gt;Try doing the plot with the NUMERIC variable and use a FORMAT statement in GPLOT to associate the format with the variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OR pay attention to such sort order issues when building the format to pad the leading values with blanks&lt;/P&gt;
&lt;PRE&gt;roc format library = library;
   value Account_Range	
   low-100  ='   0-100'
   101-200  =' 101-200'
   201-300  =' 201-300'
   301-400  =' 301-400'
   401-500  =' 401-500'
   501-600  =' 501-600'
   601-700  =' 601-700'
   701-800  =' 701-800'
   801-900  =' 801-900'
   901-1000 =' 901-1000'
   1001-2000='1000-2000'
   2001-high='2001+'
   ;
	     
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 May 2019 14:47:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-the-x-axis-order-in-GPLOT/m-p/556445#M9822</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-06T14:47:07Z</dc:date>
    </item>
  </channel>
</rss>

