<?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 Most Recent Records in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Most-Recent-Records/m-p/117482#M9869</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to run a query in Enterprise Guide that gives me the most recent records.&amp;nbsp; I am working with mortgage tables that show multiple submits per LOAN_ID.&amp;nbsp; So what I am trying to do is to return the latest full record (50 fields) with the LOAN_ID being unique in the output.&amp;nbsp; To find the latest record, I can use either of 2 fields:&lt;/P&gt;&lt;P&gt;ANALYSIS_DATE (DATE)&lt;/P&gt;&lt;P&gt;EXECUTION_ID (NUMERIC - AUTONUMBER)&lt;/P&gt;&lt;P&gt;I realize that I can group by LOAN_ID and take the MAX of either of these fields, but that does not give me then newest entire record.&amp;nbsp; Can anybody point me in the right direction?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mahalo.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 May 2012 18:32:29 GMT</pubDate>
    <dc:creator>MauiBound</dc:creator>
    <dc:date>2012-05-16T18:32:29Z</dc:date>
    <item>
      <title>Most Recent Records</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Most-Recent-Records/m-p/117482#M9869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to run a query in Enterprise Guide that gives me the most recent records.&amp;nbsp; I am working with mortgage tables that show multiple submits per LOAN_ID.&amp;nbsp; So what I am trying to do is to return the latest full record (50 fields) with the LOAN_ID being unique in the output.&amp;nbsp; To find the latest record, I can use either of 2 fields:&lt;/P&gt;&lt;P&gt;ANALYSIS_DATE (DATE)&lt;/P&gt;&lt;P&gt;EXECUTION_ID (NUMERIC - AUTONUMBER)&lt;/P&gt;&lt;P&gt;I realize that I can group by LOAN_ID and take the MAX of either of these fields, but that does not give me then newest entire record.&amp;nbsp; Can anybody point me in the right direction?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mahalo.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2012 18:32:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Most-Recent-Records/m-p/117482#M9869</guid>
      <dc:creator>MauiBound</dc:creator>
      <dc:date>2012-05-16T18:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: Most Recent Records</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Most-Recent-Records/m-p/117483#M9870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't use EG much, but in SQL query you have to join the summary query to the original table like in the query below. Maybe that will give you a clue to what you have to do in EG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table want as&lt;/P&gt;&lt;P&gt;select&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m.*&lt;/P&gt;&lt;P&gt;from&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mortgage_table&amp;nbsp;&amp;nbsp; m&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; join&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ( select loan_id, max( execution_id ) as max_id&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from mortgage_table&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; group by load_id )&amp;nbsp;&amp;nbsp; s&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m.loan_id = s.loan_id and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m.execution_id = s.max_id&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2012 20:11:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Most-Recent-Records/m-p/117483#M9870</guid>
      <dc:creator>FloydNevseta</dc:creator>
      <dc:date>2012-05-16T20:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: Most Recent Records</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Most-Recent-Records/m-p/117484#M9871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can get what you want by using&amp;nbsp; &lt;SPAN style="font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;&lt;SPAN style="color: #ff0000;"&gt;Sort task&lt;/SPAN&gt; , not the &lt;SPAN style="color: #ff0000;"&gt;query builder&lt;/SPAN&gt;. first sort you data by loan_id and date, then sort by loan_id again and select the sort option&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="mso-bidi-language: AR-SA; mso-fareast-language: EN-US; mso-bidi-font-family: 'Times New Roman'; font-size: 11pt; mso-ansi-language: EN-US; mso-hansi-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; font-family: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-theme-font: minor-bidi;"&gt;&lt;SPAN style="color: #ff0000;"&gt;'only keep the first record of each 'Sort By' '&lt;/SPAN&gt;. please check the attached screen shot.&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/11715iC73C3C16DE0B858F/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="sort option.png" title="sort option.png" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 May 2012 14:52:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Most-Recent-Records/m-p/117484#M9871</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-05-17T14:52:32Z</dc:date>
    </item>
    <item>
      <title>Re: Most Recent Records</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Most-Recent-Records/m-p/117485#M9872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Linlin.&amp;nbsp; That was exactly what I was looking for!:smileycool:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 May 2012 21:29:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Most-Recent-Records/m-p/117485#M9872</guid>
      <dc:creator>MauiBound</dc:creator>
      <dc:date>2012-05-17T21:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: Most Recent Records</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Most-Recent-Records/m-p/117486#M9873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can sort in the desc order and keep only the 1st record as mentioned above!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2012 04:55:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Most-Recent-Records/m-p/117486#M9873</guid>
      <dc:creator>Petersas</dc:creator>
      <dc:date>2012-05-22T04:55:30Z</dc:date>
    </item>
  </channel>
</rss>

