<?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 How to get the average, excluding top 10%, by group with SAS/SQL?! in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-average-excluding-top-10-by-group-with-SAS-SQL/m-p/800849#M315111</link>
    <description>&lt;P&gt;Sample data below, say, here is 100 rows/group, need to get the average of X in each group with excluding&lt;/P&gt;
&lt;P&gt;the top 10 values?!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data temp; do i=1 to 1000; grp=floor((i-1)/100)+1; x=ranuni(i); output; end; run;quit;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Mar 2022 13:57:16 GMT</pubDate>
    <dc:creator>hellohere</dc:creator>
    <dc:date>2022-03-08T13:57:16Z</dc:date>
    <item>
      <title>How to get the average, excluding top 10%, by group with SAS/SQL?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-average-excluding-top-10-by-group-with-SAS-SQL/m-p/800849#M315111</link>
      <description>&lt;P&gt;Sample data below, say, here is 100 rows/group, need to get the average of X in each group with excluding&lt;/P&gt;
&lt;P&gt;the top 10 values?!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data temp; do i=1 to 1000; grp=floor((i-1)/100)+1; x=ranuni(i); output; end; run;quit;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 13:57:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-average-excluding-top-10-by-group-with-SAS-SQL/m-p/800849#M315111</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2022-03-08T13:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the average, excluding top 10%, by group with SAS/SQL?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-average-excluding-top-10-by-group-with-SAS-SQL/m-p/800851#M315112</link>
      <description>&lt;P&gt;Don't use SQL for this, use PROC RANK (&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers/ta-p/352068" target="_self"&gt;Maxim 14: Use the right tool&lt;/A&gt;). The benefit is that PROC RANK makes this simple, and furthermore gives you several options for handling ties.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc rank data=temp groups=10 out=deciles;
    by grp;
    var x;
    ranks decile;
run;

proc means data=deciles;
    by grp;
    where decile &amp;lt; 9;
    var x;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 14:02:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-average-excluding-top-10-by-group-with-SAS-SQL/m-p/800851#M315112</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-03-08T14:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the average, excluding top 10%, by group with SAS/SQL?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-average-excluding-top-10-by-group-with-SAS-SQL/m-p/800853#M315114</link>
      <description>&lt;P&gt;Thanks a huge. Anyway to do a list of variables, and save out the means into a dataset?!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 14:11:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-average-excluding-top-10-by-group-with-SAS-SQL/m-p/800853#M315114</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2022-03-08T14:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the average, excluding top 10%, by group with SAS/SQL?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-average-excluding-top-10-by-group-with-SAS-SQL/m-p/800856#M315116</link>
      <description>&lt;P&gt;Yes, you can use variable lists in both PROC RANK and PROC MEANS. PROC MEANS also allows you to create output data sets.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 14:32:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-average-excluding-top-10-by-group-with-SAS-SQL/m-p/800856#M315116</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-03-08T14:32:24Z</dc:date>
    </item>
  </channel>
</rss>

