<?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: SQL: Problem getting Barplot to sort? in SAS Software for Learning Community</title>
    <link>https://communities.sas.com/t5/SAS-Software-for-Learning/SQL-Problem-getting-Barplot-to-sort/m-p/949883#M2423</link>
    <description>Thanks, that was what I was looking for.&lt;BR /&gt;&lt;BR /&gt;David&lt;BR /&gt;</description>
    <pubDate>Tue, 05 Nov 2024 01:07:11 GMT</pubDate>
    <dc:creator>davidjayjackson</dc:creator>
    <dc:date>2024-11-05T01:07:11Z</dc:date>
    <item>
      <title>SQL: Problem getting Barplot to sort?</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/SQL-Problem-getting-Barplot-to-sort/m-p/949878#M2421</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;When I run the code below, the barplot is not shorting by city name and not city_count. Thanks David&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;libname party xlsx "/home/u64077777/My SAS File/Party.xlsx";


proc sql;
	drop table invites_summary;
	CREATE TABLE invites_summary AS
	SELECT City,count(*) as city_count
		FROM Party.contacts
		GROUP BY City;
quit;

proc sort data=invites_summary out=sorted_invites_summary;
    by descending city_count;
run;

proc sgplot data=sorted_invites_summary;
    hbar City / response=city_count;
    xaxis label="City";
    yaxis label="Number of People Invited";
run;&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2024 22:49:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/SQL-Problem-getting-Barplot-to-sort/m-p/949878#M2421</guid>
      <dc:creator>davidjayjackson</dc:creator>
      <dc:date>2024-11-04T22:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: SQL: Problem getting Barplot to sort?</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/SQL-Problem-getting-Barplot-to-sort/m-p/949879#M2422</link>
      <description>&lt;P&gt;If you want the the plot to be sorted by the Response variable value you use the option CATEGORYORDER with either RESPASC or RESPDESC to order in response variable ascending or descending order respectively.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sgplot data=sorted_invites_summary;
    hbar City / response=city_count  categoryorder=respdesc;
    xaxis label="City";
    yaxis label="Number of People Invited";
run;&lt;/PRE&gt;
&lt;P&gt;Note that for many of the graph types sorting the data doesn't really translate to order in the graph unless there is a DATA option for an some sort of Order related option.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2024 23:40:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/SQL-Problem-getting-Barplot-to-sort/m-p/949879#M2422</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-11-04T23:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: SQL: Problem getting Barplot to sort?</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/SQL-Problem-getting-Barplot-to-sort/m-p/949883#M2423</link>
      <description>Thanks, that was what I was looking for.&lt;BR /&gt;&lt;BR /&gt;David&lt;BR /&gt;</description>
      <pubDate>Tue, 05 Nov 2024 01:07:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/SQL-Problem-getting-Barplot-to-sort/m-p/949883#M2423</guid>
      <dc:creator>davidjayjackson</dc:creator>
      <dc:date>2024-11-05T01:07:11Z</dc:date>
    </item>
  </channel>
</rss>

