<?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: The order of Average value when missing data is involved in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/The-order-of-Average-value-when-missing-data-is-involved/m-p/519761#M140841</link>
    <description>&lt;P&gt;Thanks!!&lt;/P&gt;&lt;P&gt;Yes, I found that later on that it used "alphabetic" order. Thank you!!!&lt;/P&gt;</description>
    <pubDate>Sun, 09 Dec 2018 18:53:56 GMT</pubDate>
    <dc:creator>jc3992</dc:creator>
    <dc:date>2018-12-09T18:53:56Z</dc:date>
    <item>
      <title>The order of Average value when missing data is involved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-order-of-Average-value-when-missing-data-is-involved/m-p/519756#M140838</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wonder may I ask why in the output of the code below,&lt;/P&gt;&lt;P&gt;the average value of "Jones" which is 100,&lt;/P&gt;&lt;P&gt;would be ordered higher than that for "Smith", which is 400.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data work.one;
  input Rep $ Cost;
  cards;
  Smith 200
  Smith 400
  Jones 100
  Smith 600
  Jones 100
  Chang 400
  Jones .
  Chang 600
  ;

proc sql;
  select Rep, avg(Cost) as Average
  from one
  group by Rep
  having Average ge 100
  order by Rep
  ;
  quit
  ;
  &lt;/PRE&gt;</description>
      <pubDate>Sun, 09 Dec 2018 17:07:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-order-of-Average-value-when-missing-data-is-involved/m-p/519756#M140838</guid>
      <dc:creator>jc3992</dc:creator>
      <dc:date>2018-12-09T17:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: The order of Average value when missing data is involved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-order-of-Average-value-when-missing-data-is-involved/m-p/519758#M140839</link>
      <description>&lt;P&gt;You have the expression&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; "order by rep"&lt;/P&gt;
&lt;P&gt;which tells sql to sequence results sorted by rep&amp;nbsp; (change, jones, smith).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But even if you drop this expression, you also have "group by rep".&amp;nbsp;&amp;nbsp; proc sql needs a way to establish those groups, and it seems that sql is using alphabetic order to determine how to assign an individual row to a group.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you need to order by the new variable average.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; "order by average"&lt;/P&gt;
&lt;P&gt;or&amp;nbsp;&lt;BR /&gt;&amp;nbsp; "order by average descending"&lt;/P&gt;</description>
      <pubDate>Sun, 09 Dec 2018 17:33:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-order-of-Average-value-when-missing-data-is-involved/m-p/519758#M140839</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-12-09T17:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: The order of Average value when missing data is involved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-order-of-Average-value-when-missing-data-is-involved/m-p/519761#M140841</link>
      <description>&lt;P&gt;Thanks!!&lt;/P&gt;&lt;P&gt;Yes, I found that later on that it used "alphabetic" order. Thank you!!!&lt;/P&gt;</description>
      <pubDate>Sun, 09 Dec 2018 18:53:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-order-of-Average-value-when-missing-data-is-involved/m-p/519761#M140841</guid>
      <dc:creator>jc3992</dc:creator>
      <dc:date>2018-12-09T18:53:56Z</dc:date>
    </item>
  </channel>
</rss>

