<?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: Find last transaction date in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-last-transaction-date/m-p/298307#M20323</link>
    <description>&lt;P&gt;See this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Have;
input DumpKey Acco_NO :$10. ReportDate :mmddyy10. ProductionDate :yymmdd8. Balance_Amount;
format ReportDate ProductionDate mmddyy10.;
cards;
1210 1210-33340 8/24/2016 20160808 300
1210 1210-33340 8/28/2016 20160808 355
1210 1210-33340 9/4/2016 20160808 222
1210 1210-33340 8/24/2016 20160829 310
1210 1210-33340 8/28/2016 20160829 30
1210 1210-33340 9/4/2016 20160829 550
1210 1022-21650 8/24/2016 20160822 345
1210 1022-21650 8/28/2016 20160822 335
1210 1022-21650 9/4/2016 20160822 60
1210 1022-21650 9/4/2016 20160809 50
;
run;

proc sort data=have;
by DumpKey Acco_NO ReportDate ProductionDate Balance_Amount;
run;

data want;
set have;
by DumpKey Acco_NO ReportDate ProductionDate Balance_Amount;
if last.ReportDate then output;
run;

proc print data=want noobs;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This gave me the output&lt;/P&gt;
&lt;PRE&gt;Dump                                Production    Balance_
 Key     Acco_NO      ReportDate       Date        Amount

1210    1022-21650    08/24/2016    08/22/2016       345  
1210    1022-21650    08/28/2016    08/22/2016       335  
1210    1022-21650    09/04/2016    08/22/2016        60  
1210    1210-33340    08/24/2016    08/29/2016       310  
1210    1210-33340    08/28/2016    08/29/2016        30  
1210    1210-33340    09/04/2016    08/29/2016       550  
&lt;/PRE&gt;
&lt;P&gt;Which means that the condition was true 6 times.&lt;/P&gt;</description>
    <pubDate>Wed, 14 Sep 2016 15:42:42 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2016-09-14T15:42:42Z</dc:date>
    <item>
      <title>Find last transaction date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-last-transaction-date/m-p/298302#M20320</link>
      <description>&lt;P&gt;DATA WANT;&lt;BR /&gt;SET HAVE;&lt;BR /&gt;BY DUMPKEY ACCO_NO REPORTDATE PRODUCTIONDATE BALANCE_AMOUNT;&lt;/P&gt;
&lt;P&gt;IF LAST.REPORTDATE THEN OUTPUT;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;BR /&gt;for the combination of (Acco_NO ReportDate ProductionDate) these variables &lt;STRONG&gt;Last .ReportDate &lt;/STRONG&gt;its not happning&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pls help me to to get the &lt;STRONG&gt;last.ReportDate &lt;/STRONG&gt;above mentioned &lt;STRONG&gt;combination.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please find the attached data for referance&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2016 15:39:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-last-transaction-date/m-p/298302#M20320</guid>
      <dc:creator>sivastat08</dc:creator>
      <dc:date>2016-09-14T15:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: Find last transaction date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-last-transaction-date/m-p/298303#M20321</link>
      <description>&lt;P&gt;Please supply your test data in text form; do a data step with cards like this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input var1 var2 var3;
cards;
1 2 3
4 5 6
7 8 9
;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Nobody in his right mind opens a Excel file from the web.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2016 15:39:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-last-transaction-date/m-p/298303#M20321</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-09-14T15:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: Last.Transsection Date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-last-transaction-date/m-p/298304#M20322</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Have;&lt;BR /&gt;input DumpKey Acco_NO ReportDate ProductionDate Balance_Amount;&lt;BR /&gt;cards;&lt;BR /&gt;1210 1210-33340 8/24/2016 20160808 300&lt;BR /&gt;1210 1210-33340 8/28/2016 20160808 355&lt;BR /&gt;1210 1210-33340 9/4/2016 20160808 222&lt;BR /&gt;1210 1210-33340 8/24/2016 20160829 310&lt;BR /&gt;1210 1210-33340 8/28/2016 20160829 30&lt;BR /&gt;1210 1210-33340 9/4/2016 20160829 550&lt;BR /&gt;1210 1022-21650 8/24/2016 20160822 345&lt;BR /&gt;1210 1022-21650 8/28/2016 20160822 335&lt;BR /&gt;1210 1022-21650 9/4/2016 20160822 60&lt;BR /&gt;1210 1022-21650 9/4/2016 20160809 50&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2016 12:57:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-last-transaction-date/m-p/298304#M20322</guid>
      <dc:creator>sivastat08</dc:creator>
      <dc:date>2016-09-14T12:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: Find last transaction date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-last-transaction-date/m-p/298307#M20323</link>
      <description>&lt;P&gt;See this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Have;
input DumpKey Acco_NO :$10. ReportDate :mmddyy10. ProductionDate :yymmdd8. Balance_Amount;
format ReportDate ProductionDate mmddyy10.;
cards;
1210 1210-33340 8/24/2016 20160808 300
1210 1210-33340 8/28/2016 20160808 355
1210 1210-33340 9/4/2016 20160808 222
1210 1210-33340 8/24/2016 20160829 310
1210 1210-33340 8/28/2016 20160829 30
1210 1210-33340 9/4/2016 20160829 550
1210 1022-21650 8/24/2016 20160822 345
1210 1022-21650 8/28/2016 20160822 335
1210 1022-21650 9/4/2016 20160822 60
1210 1022-21650 9/4/2016 20160809 50
;
run;

proc sort data=have;
by DumpKey Acco_NO ReportDate ProductionDate Balance_Amount;
run;

data want;
set have;
by DumpKey Acco_NO ReportDate ProductionDate Balance_Amount;
if last.ReportDate then output;
run;

proc print data=want noobs;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This gave me the output&lt;/P&gt;
&lt;PRE&gt;Dump                                Production    Balance_
 Key     Acco_NO      ReportDate       Date        Amount

1210    1022-21650    08/24/2016    08/22/2016       345  
1210    1022-21650    08/28/2016    08/22/2016       335  
1210    1022-21650    09/04/2016    08/22/2016        60  
1210    1210-33340    08/24/2016    08/29/2016       310  
1210    1210-33340    08/28/2016    08/29/2016        30  
1210    1210-33340    09/04/2016    08/29/2016       550  
&lt;/PRE&gt;
&lt;P&gt;Which means that the condition was true 6 times.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2016 15:42:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-last-transaction-date/m-p/298307#M20323</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-09-14T15:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: Last.Transsection Date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-last-transaction-date/m-p/298308#M20324</link>
      <description>&lt;P&gt;In order to get last.reportdate for that combination, you have to change the order of the BY statement to put the productiondate before the reportdate.&amp;nbsp; You also need to sort the data.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2016 13:03:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-last-transaction-date/m-p/298308#M20324</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2016-09-14T13:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: Last.Transsection Date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-last-transaction-date/m-p/298309#M20325</link>
      <description>&lt;P&gt;Thanks for the replay.I will try.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Siva&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2016 13:05:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-last-transaction-date/m-p/298309#M20325</guid>
      <dc:creator>sivastat08</dc:creator>
      <dc:date>2016-09-14T13:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: Last.Transsection Date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-last-transaction-date/m-p/298310#M20326</link>
      <description>&lt;P&gt;Thanks .this is what i want.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2016 13:09:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Find-last-transaction-date/m-p/298310#M20326</guid>
      <dc:creator>sivastat08</dc:creator>
      <dc:date>2016-09-14T13:09:09Z</dc:date>
    </item>
  </channel>
</rss>

