<?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 Alternate to max function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Alternate-to-max-function/m-p/20261#M3147</link>
    <description>Hi experts,&lt;BR /&gt;
&lt;BR /&gt;
Is there an alternate(and more efficient) way on getting the max value for a particular column? currently i'm using max function on proc sql. &lt;BR /&gt;
&lt;BR /&gt;
Thanks!&lt;BR /&gt;
Milton</description>
    <pubDate>Wed, 12 May 2010 05:53:44 GMT</pubDate>
    <dc:creator>milts</dc:creator>
    <dc:date>2010-05-12T05:53:44Z</dc:date>
    <item>
      <title>Alternate to max function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Alternate-to-max-function/m-p/20261#M3147</link>
      <description>Hi experts,&lt;BR /&gt;
&lt;BR /&gt;
Is there an alternate(and more efficient) way on getting the max value for a particular column? currently i'm using max function on proc sql. &lt;BR /&gt;
&lt;BR /&gt;
Thanks!&lt;BR /&gt;
Milton</description>
      <pubDate>Wed, 12 May 2010 05:53:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Alternate-to-max-function/m-p/20261#M3147</guid>
      <dc:creator>milts</dc:creator>
      <dc:date>2010-05-12T05:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: Alternate to max function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Alternate-to-max-function/m-p/20262#M3148</link>
      <description>I think the MEANS procedure is nice enough for it.</description>
      <pubDate>Wed, 12 May 2010 09:58:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Alternate-to-max-function/m-p/20262#M3148</guid>
      <dc:creator>YueweiLiu</dc:creator>
      <dc:date>2010-05-12T09:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: Alternate to max function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Alternate-to-max-function/m-p/20263#M3149</link>
      <description>My experience has been that SQL runs faster for deriving a few basic statistics like mean, sum, max with simple grouping, even if the code is longer. There is a significant overhead just invoking the MEANS procedure so for simple statistics and single level grouping it is usually slower. &lt;BR /&gt;
&lt;BR /&gt;
However MEANS is definitely a better choice for more complicated grouping and statistics.</description>
      <pubDate>Mon, 17 May 2010 02:16:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Alternate-to-max-function/m-p/20263#M3149</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2010-05-17T02:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: Alternate to max function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Alternate-to-max-function/m-p/20264#M3150</link>
      <description>What costs in this operation is to do a table scan to find out the maximum value. So I don't think that any technique is more efficient than any other.&lt;BR /&gt;
&lt;BR /&gt;
In SPD Server (and other RDBMS?), if your max column is indexed, the query will get the answer by just analyse the index meta data. On large tables, this could boost performance with thousands of percent... It's a pity that this hasn't been implemented (yet) for Base SAS engine/SQL, since the information in the index is already available.&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Mon, 17 May 2010 07:21:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Alternate-to-max-function/m-p/20264#M3150</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2010-05-17T07:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: Alternate to max function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Alternate-to-max-function/m-p/20265#M3151</link>
      <description>try to use proc sort;&lt;BR /&gt;
Such as:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc sort data=yourdataset;&lt;BR /&gt;
  by descending yourvar;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]  &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Good Luck.&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: Ksharp

Message was edited by: Ksharp</description>
      <pubDate>Mon, 17 May 2010 07:26:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Alternate-to-max-function/m-p/20265#M3151</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-05-17T07:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: Alternate to max function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Alternate-to-max-function/m-p/20266#M3152</link>
      <description>While Linus is correct in that no one technique is necessarily more efficient than another, I stand by my comment that the MEANS procedure has a significant invocation overhead compared to SQL.&lt;BR /&gt;
&lt;BR /&gt;
Therefore simple summary stats in SQL like for example:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  create table sum as&lt;BR /&gt;
  mean(age),&lt;BR /&gt;
  max(height&lt;BR /&gt;
  from sashelp.class&lt;BR /&gt;
  group by sex;&lt;BR /&gt;
&lt;BR /&gt;
can often be more efficient than the procedure. Please note this is only worth pursuing for large datasets where you have performance issues and you do have to benchmark your methods for ultimate proof.</description>
      <pubDate>Tue, 18 May 2010 02:46:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Alternate-to-max-function/m-p/20266#M3152</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2010-05-18T02:46:48Z</dc:date>
    </item>
  </channel>
</rss>

