<?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: Question about Proc gchart in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Question-about-Proc-gchart/m-p/648694#M19950</link>
    <description>&lt;P&gt;If you want values to sort then use values that sort properly. In this case I would suggest going back to your data and doing one of two things:&lt;/P&gt;
&lt;P&gt;1) Create a date valued variable instead of text with values like 'Jan' with a format of MONNAME3.&lt;/P&gt;
&lt;P&gt;2) Create a numeric variable with values of 1 to 12 and assign a custom format that will display 1 as Jan, 2 as Feb and so on.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of these two I strongly recommend learning to use DATE values as they are very flexible and there are many tools to manipulate or display values.&lt;/P&gt;
&lt;P&gt;If you do not have an actual date value this is one way to get it from what appears to be in your data:&lt;/P&gt;
&lt;PRE&gt;data want;
   set hotel.main1;
   y= input(cats('01',substr(arrival_date_month,1,3),'2020'),date9.);
   format y monname3.;
run;&lt;/PRE&gt;
&lt;P&gt;Use Y, or what ever variable you create, instead of arrival_date_month.&lt;/P&gt;
&lt;P&gt;Or if you already have a full date variable use that but apply a MONNAME3. (or 4) format.&lt;/P&gt;
&lt;P&gt;The above code uses a fixed year because I really don't know your data. If you have a numeric year you could use that variable instead of '2020'. Even when dates are across years the formatted value should be used to create the groups.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 May 2020 14:21:46 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-05-27T14:21:46Z</dc:date>
    <item>
      <title>Question about Proc gchart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Question-about-Proc-gchart/m-p/647208#M19947</link>
      <description>&lt;P&gt;Hi i am a student,&lt;/P&gt;&lt;P&gt;I am very new to sas and am working on hotel demand dataset, I want to show the maximum booking month by counting the values of arrival_date_month which is a variable in my dataset. I tried it but i am not getting what i want. I want to sort the order of variables inside a bar chart,please help!&lt;/P&gt;&lt;P&gt;I have used this code:&lt;/P&gt;&lt;P&gt;axis label=(h=10pt font='Arial/bo');&lt;/P&gt;&lt;P&gt;&amp;nbsp;axis label=(h=10pt font='Arial/bo' angle=90);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;ods listing;&lt;BR /&gt;&amp;nbsp;proc gchart data=hotel.main1;&lt;BR /&gt;title 'Highest booking month';&lt;BR /&gt;&amp;nbsp;vbar arrival_date_month / type=sum&lt;BR /&gt;&amp;nbsp;patternid=midpoint&lt;BR /&gt;&amp;nbsp;maxis=axis1&lt;BR /&gt;&amp;nbsp;raxis=axis2;&lt;BR /&gt;label arrival_date_month='count';&lt;BR /&gt;&amp;nbsp;run;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please help where i am wrong in the code? Please let me know i can explain better my question .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Amali&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 19:58:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Question-about-Proc-gchart/m-p/647208#M19947</guid>
      <dc:creator>Amali6</dc:creator>
      <dc:date>2020-05-12T19:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Proc gchart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Question-about-Proc-gchart/m-p/647585#M19948</link>
      <description>&lt;P&gt;What variables inside a bar chart? You don't say what that variable would be.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would also suggest moving to Proc SGPLOT instead. There isn't any development going on with the older Gchart and Gplot procedures.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe something along these lines:&lt;/P&gt;
&lt;PRE&gt;proc sgplot data=hotel.main1;
 vbar arrival_date_month /response=&amp;lt;some variable name to sum&amp;gt;
           stat=sum group=&amp;lt;variable to indicate groups&amp;gt;
           groupdisplay=stack grouporder= data
 ;
 label arrival_date_month='count';
 run;&lt;/PRE&gt;
&lt;P&gt;creates on bar for each value of arrival_date_month;&lt;/P&gt;
&lt;P&gt;the variable after RESPONSE is what would be summed to get the size of the value block&lt;/P&gt;
&lt;P&gt;Group would be any variable indicating a group of related records maybe "hotel" since your topic may involve hotels, or a variable that holds a geographic indicator.&lt;/P&gt;
&lt;P&gt;Groupdisplay can be Stack (one bar) or Cluster which would have each group value as a separate bar within the month . The&amp;nbsp; grouporder indicates which order to arrange the groups, data use the value of the statistic.&lt;/P&gt;
&lt;P&gt;The Xaxis and Yaxis statement in the procedure provide options but the syntax is different than the AXIS statements.&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 18:59:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Question-about-Proc-gchart/m-p/647585#M19948</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-13T18:59:44Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Proc gchart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Question-about-Proc-gchart/m-p/647595#M19949</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Amali6_0-1589399430111.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/39389i34854179D3F1F209/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Amali6_0-1589399430111.png" alt="Amali6_0-1589399430111.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I got this output for the barchart code which i posted, here in y axis i would like to sort the months from jan to december. Could you help how to sort the months in my coding ?&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 19:53:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Question-about-Proc-gchart/m-p/647595#M19949</guid>
      <dc:creator>Amali6</dc:creator>
      <dc:date>2020-05-13T19:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Proc gchart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Question-about-Proc-gchart/m-p/648694#M19950</link>
      <description>&lt;P&gt;If you want values to sort then use values that sort properly. In this case I would suggest going back to your data and doing one of two things:&lt;/P&gt;
&lt;P&gt;1) Create a date valued variable instead of text with values like 'Jan' with a format of MONNAME3.&lt;/P&gt;
&lt;P&gt;2) Create a numeric variable with values of 1 to 12 and assign a custom format that will display 1 as Jan, 2 as Feb and so on.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of these two I strongly recommend learning to use DATE values as they are very flexible and there are many tools to manipulate or display values.&lt;/P&gt;
&lt;P&gt;If you do not have an actual date value this is one way to get it from what appears to be in your data:&lt;/P&gt;
&lt;PRE&gt;data want;
   set hotel.main1;
   y= input(cats('01',substr(arrival_date_month,1,3),'2020'),date9.);
   format y monname3.;
run;&lt;/PRE&gt;
&lt;P&gt;Use Y, or what ever variable you create, instead of arrival_date_month.&lt;/P&gt;
&lt;P&gt;Or if you already have a full date variable use that but apply a MONNAME3. (or 4) format.&lt;/P&gt;
&lt;P&gt;The above code uses a fixed year because I really don't know your data. If you have a numeric year you could use that variable instead of '2020'. Even when dates are across years the formatted value should be used to create the groups.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 14:21:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Question-about-Proc-gchart/m-p/648694#M19950</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-27T14:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Proc gchart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Question-about-Proc-gchart/m-p/650952#M19972</link>
      <description>&lt;P&gt;If you want to do it with gchart, here's a short example showing how ... Note that I use a numeric date value (which controls the order of the bars), and I apply the monname3. format (which prints the numeric date as the 3-character text month name). Also note that I use the 'discrete' option (otherwise gchart might group bars together like a histogram).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data foo; set sashelp.stocks (where=(stock='IBM' and year(date)=2004));&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;title "IBM Stock Price in 2004";&lt;BR /&gt;axis1 label=none minor=none;&lt;BR /&gt;proc gchart data=foo;&lt;BR /&gt;format date monname3.;&lt;BR /&gt;vbar date / discrete type=mean sumvar=close raxis=axis1 maxis=axis1;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="stock_bar.png" style="width: 800px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/40020iABA0F82A97BF660A/image-size/large?v=v2&amp;amp;px=999" role="button" title="stock_bar.png" alt="stock_bar.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 00:58:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Question-about-Proc-gchart/m-p/650952#M19972</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2020-05-27T00:58:23Z</dc:date>
    </item>
  </channel>
</rss>

