<?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: Get maximum value without sorting in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Get-maximum-value-without-sorting/m-p/311832#M67504</link>
    <description>&lt;P&gt;It depends on the sorting of bank.dates and the indexes defined on that table. You can let SQL figure that out with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table bank.salmnth as 
select *, put(nDate, monName.) as lastMonth
from bank.dates
group by Acct
having nDate=max(nDate);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 15 Nov 2016 19:24:17 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2016-11-15T19:24:17Z</dc:date>
    <item>
      <title>Get maximum value without sorting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-maximum-value-without-sorting/m-p/311820#M67498</link>
      <description>&lt;P&gt;account numbers are shown in Acct ndate is the sasdate for the salary drawn&lt;/P&gt;
&lt;P&gt;i want to create a variable with the last drawn salary month&lt;/P&gt;
&lt;P&gt;i have tried&lt;/P&gt;
&lt;P&gt;proc sort data=bank.dates out=bank.aa;&lt;BR /&gt;by Acct ndate;&lt;BR /&gt;run;&lt;BR /&gt;proc print;run;&lt;/P&gt;
&lt;P&gt;data bank.salmnth;&lt;BR /&gt;set bank.aa;&lt;BR /&gt;by Acct ndate;&lt;BR /&gt;if last.Acct then lastmonth=PUT(ndate,monname.);&lt;BR /&gt;run;&lt;BR /&gt;proc print;run;&lt;/P&gt;
&lt;P&gt;what is the alternative for if last.Acct then lastmonth=PUT(ndate,monname.); in data step without proc sort?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2016 19:15:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-maximum-value-without-sorting/m-p/311820#M67498</guid>
      <dc:creator>basabi</dc:creator>
      <dc:date>2016-11-15T19:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: Get maximum value without sorting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-maximum-value-without-sorting/m-p/311832#M67504</link>
      <description>&lt;P&gt;It depends on the sorting of bank.dates and the indexes defined on that table. You can let SQL figure that out with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table bank.salmnth as 
select *, put(nDate, monName.) as lastMonth
from bank.dates
group by Acct
having nDate=max(nDate);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Nov 2016 19:24:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-maximum-value-without-sorting/m-p/311832#M67504</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-11-15T19:24:17Z</dc:date>
    </item>
  </channel>
</rss>

