<?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: if last.group then output in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131750#M26830</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does not sounds like you want LAST. processing at all. Instead you want to select all records that have the maximum value of SRCDATE.&amp;nbsp; I am still a little unclear on what your other grouping variables are.&amp;nbsp; It seems clear that GVKEY and DATADATE are important, but it is no clear whether STYPE is a grouping variable or not because it is a constant in your sample data.&amp;nbsp; This query should do what want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc sql noprint ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;create table want as&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; select * &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; from have&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; group by gvkey, stype, datadate&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; having srcdate = max(srcdate)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it also selects the observation where GVKEY=1035 and SID=99 because it has the same DATADATE and SRCDATE as the one with SID=10.&amp;nbsp; Perhaps that was on oversight in your original listing of the expected output?&amp;nbsp; Or is there another rule that would exclude that observation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Mar 2013 02:55:58 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2013-03-11T02:55:58Z</dc:date>
    <item>
      <title>if last.group then output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131740#M26820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"&gt;Hi, all&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 115%; font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA;"&gt;I thought of using data set if last. to keep records for the most recent srcdate &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-top: auto; margin-bottom: auto;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"&gt;Data have: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="padding: 0px 5.4pt; margin-left: 4.65pt;" width="333"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;GVKEY&lt;/STRONG&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;SID&lt;/STRONG&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;SALES&lt;/STRONG&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;datadate&lt;/STRONG&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;srcdate&lt;/STRONG&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;1034&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;6&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;60.806&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;1034&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;8&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;16.051&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;1034&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;5&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;303.253&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;1034&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;4&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;197.301&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;1034&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;7&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;169.194&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;1034&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;9&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;0&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;1034&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;STRONG style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;99&lt;/STRONG&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;-4.429&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;1034&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;9&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;0&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;20001231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;1034&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;8&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;16.051&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;20001231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;1034&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;4&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;197.301&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;20001231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;1034&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;6&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;60.806&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;20001231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;1034&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;7&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;169.194&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;20001231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;1034&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;5&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;303.253&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;20001231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;1034&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;99&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;-4.429&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;20001231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;1035&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;9&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;0&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;20001231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;20001231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;1035&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;7&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;305.714&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;20001231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;20001231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;1035&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;5&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;309.296&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;20001231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;20001231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;1035&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;99&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;-5.09&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;20001231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;20011231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;1035&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;6&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;62.692&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;20001231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;20011231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;1035&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;8&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="64"&gt;&lt;BR /&gt;&amp;nbsp; &lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;13.903&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;20001231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt;&lt;TD style="background: white; padding: 0px 5.4pt;" valign="top" width="71"&gt;&lt;BR /&gt;&amp;nbsp; &lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;20011231&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&amp;nbsp; &lt;/TD&gt; &lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 115%; font-family: 'TimesNewRomanPS-ItalicMT','serif'; font-size: 12pt; mso-bidi-font-family: TimesNewRomanPS-ItalicMT; mso-bidi-font-style: italic;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 115%; font-family: 'TimesNewRomanPS-ItalicMT','serif'; font-size: 12pt; mso-bidi-font-family: TimesNewRomanPS-ItalicMT; mso-bidi-font-style: italic;"&gt;Expected output: &lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="1050"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="63" width="200"&gt;GVKEY&lt;/TD&gt;&lt;TD class="xl65" width="200"&gt;SID&lt;/TD&gt;&lt;TD class="xl65" width="200"&gt;SALES&lt;/TD&gt;&lt;TD class="xl65" width="225"&gt;datadate&lt;/TD&gt;&lt;TD class="xl65" width="225"&gt;srcdate&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD align="right" class="xl67" height="63" width="200"&gt;1034&lt;/TD&gt;&lt;TD align="right" class="xl67" width="200"&gt;9&lt;/TD&gt;&lt;TD align="right" class="xl67" width="200"&gt;0&lt;/TD&gt;&lt;TD class="xl66" width="225"&gt;19991231&lt;/TD&gt;&lt;TD class="xl66" width="225"&gt;20001231&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD align="right" class="xl67" height="63" width="200"&gt;1034&lt;/TD&gt;&lt;TD align="right" class="xl67" width="200"&gt;8&lt;/TD&gt;&lt;TD align="right" class="xl67" width="200"&gt;16.051&lt;/TD&gt;&lt;TD class="xl66" width="225"&gt;19991231&lt;/TD&gt;&lt;TD class="xl66" width="225"&gt;20001231&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD align="right" class="xl67" height="63" width="200"&gt;1034&lt;/TD&gt;&lt;TD align="right" class="xl67" width="200"&gt;4&lt;/TD&gt;&lt;TD align="right" class="xl67" width="200"&gt;197.301&lt;/TD&gt;&lt;TD class="xl66" width="225"&gt;19991231&lt;/TD&gt;&lt;TD class="xl66" width="225"&gt;20001231&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD align="right" class="xl67" height="63" width="200"&gt;1034&lt;/TD&gt;&lt;TD align="right" class="xl67" width="200"&gt;6&lt;/TD&gt;&lt;TD align="right" class="xl67" width="200"&gt;60.806&lt;/TD&gt;&lt;TD class="xl66" width="225"&gt;19991231&lt;/TD&gt;&lt;TD class="xl66" width="225"&gt;20001231&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD align="right" class="xl67" height="63" width="200"&gt;1034&lt;/TD&gt;&lt;TD align="right" class="xl67" width="200"&gt;7&lt;/TD&gt;&lt;TD align="right" class="xl67" width="200"&gt;169.194&lt;/TD&gt;&lt;TD class="xl66" width="225"&gt;19991231&lt;/TD&gt;&lt;TD class="xl66" width="225"&gt;20001231&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD align="right" class="xl67" height="63" width="200"&gt;1034&lt;/TD&gt;&lt;TD align="right" class="xl67" width="200"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl67" width="200"&gt;303.253&lt;/TD&gt;&lt;TD class="xl66" width="225"&gt;19991231&lt;/TD&gt;&lt;TD class="xl66" width="225"&gt;20001231&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD align="right" class="xl67" height="63" width="200"&gt;1034&lt;/TD&gt;&lt;TD align="right" class="xl67" width="200"&gt;99&lt;/TD&gt;&lt;TD align="right" class="xl67" width="200"&gt;-4.429&lt;/TD&gt;&lt;TD class="xl66" width="225"&gt;19991231&lt;/TD&gt;&lt;TD class="xl66" width="225"&gt;20001231&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD align="right" class="xl67" height="63" width="200"&gt;1035&lt;/TD&gt;&lt;TD align="right" class="xl67" width="200"&gt;99&lt;/TD&gt;&lt;TD align="right" class="xl67" width="200"&gt;-5.09&lt;/TD&gt;&lt;TD class="xl66" width="225"&gt;20001231&lt;/TD&gt;&lt;TD class="xl66" width="225"&gt;20011231&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD align="right" class="xl67" height="63" width="200"&gt;1035&lt;/TD&gt;&lt;TD align="right" class="xl67" width="200"&gt;6&lt;/TD&gt;&lt;TD align="right" class="xl67" width="200"&gt;62.692&lt;/TD&gt;&lt;TD class="xl66" width="225"&gt;20001231&lt;/TD&gt;&lt;TD class="xl66" width="225"&gt;20011231&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt;&lt;TD align="right" class="xl67" height="63" width="200"&gt;1035&lt;/TD&gt;&lt;TD align="right" class="xl67" width="200"&gt;8&lt;/TD&gt;&lt;TD align="right" class="xl67" width="200"&gt;13.903&lt;/TD&gt;&lt;TD class="xl66" width="225"&gt;20001231&lt;/TD&gt;&lt;TD class="xl66" width="225"&gt;20011231&lt;/TD&gt; &lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; my code below did not do it. Can you help? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #000080; font-size: 10pt; font-family: Courier New;"&gt;sort&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;=TestData;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; gvkey srcdate;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; TestData;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; gvkey srcdate;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; last.gvkey;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;Lan&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Mar 2013 17:44:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131740#M26820</guid>
      <dc:creator>LanMin</dc:creator>
      <dc:date>2013-03-09T17:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: if last.group then output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131741#M26821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think your code got cutoff. Can you repost the code and your log. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Mar 2013 18:13:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131741#M26821</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-03-09T18:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: if last.group then output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131742#M26822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman', serif; font-size: 16px; background-color: #ffffff;"&gt;I thought of using data set if last. to keep records for the most recent srcdate&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman', serif; font-size: 16px; background-color: #ffffff;"&gt;Variables: GVKEY SID SALES datadate srcdate &lt;/SPAN&gt;&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;If you want the most recent SRCDATE then you probably want to test for LAST.DATADATE, or what ever the sort variable nested above SRCDATE.&lt;/P&gt;&lt;P&gt;LAST.SRCDATE would be used to keep only one record for each level of SRCDATE. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Mar 2013 18:23:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131742#M26822</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-03-09T18:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: if last.group then output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131743#M26823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your code did get cut off but, from your desired output, it appears like you were missing something anyway.&amp;nbsp; We can only guess but, from your desired output, I think you may have to add one field to your code.&amp;nbsp; Will the following do what you want?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: #000080;"&gt;proc sort&lt;/STRONG&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New'; color: #0000ff;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt;=TestData;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt;&amp;nbsp; by gvkey SID srcdate;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt;run&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt;data want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt;&amp;nbsp; set TestData;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt;&amp;nbsp; by gvkey SID;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt;&amp;nbsp; if last.SID;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Mar 2013 18:25:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131743#M26823</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-03-09T18:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: if last.group then output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131744#M26824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Many Thanks to everyone who replied to my post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My formatting was off and code was cut off. I repost my data below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dataset have : this contains company operating segment sales&lt;BR /&gt;, the last column srcdate(source year) indicates shows all historical reporting&lt;BR /&gt;data, i.e., companies could refile their operating segment data with SEC,&lt;BR /&gt;therefore, the data contains more than one srcdate for each firm. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to keep the latest source year, e.g.,&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for gvkey 1034, datadate=&lt;SPAN style="color: black; font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231, there were 2 &lt;/SPAN&gt;srcdate,&lt;BR /&gt;the older srcdate= &lt;SPAN style="color: black; font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231 with 7 rows, and the newer &lt;/SPAN&gt;srcdate=20001231 &lt;SPAN style="color: black; font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;with 7 rows, I only want to keep the 7 rows for newer &lt;/SPAN&gt;srcdate=20001231&lt;BR /&gt;. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;for gvkey 1035 I would like the same methodology. For datadate=&lt;SPAN style="color: black; font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231, there are 2 rows with only 1 &lt;/SPAN&gt;srcdate, I want to&lt;BR /&gt;keep the &lt;SPAN style="color: black; font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;2 rows. For &lt;/SPAN&gt;datadate= &lt;SPAN style="color: black; font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;20001231, there are 2 &lt;/SPAN&gt;srcdate, I want to keep the latest srcdate=&lt;BR /&gt;20011231, with corresponding 2 rows kept. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GVKEY STYPE SID SALES datadate srcdate&lt;/P&gt;&lt;P&gt;1034 OPSEG 4 197.301 19991231 19991231&lt;/P&gt;&lt;P&gt;1034 OPSEG 5 303.253 19991231 19991231&lt;/P&gt;&lt;P&gt;1034 OPSEG 6 60.806 19991231 19991231&lt;/P&gt;&lt;P&gt;1034 OPSEG 7 169.194 19991231 19991231&lt;/P&gt;&lt;P&gt;1034 OPSEG 8 16.051 19991231 19991231&lt;/P&gt;&lt;P&gt;1034 OPSEG 9 0 19991231 19991231&lt;/P&gt;&lt;P&gt;1034 OPSEG 99 -4.429 19991231 19991231&lt;/P&gt;&lt;P&gt;1034 OPSEG 4 197.301 19991231 20001231&lt;/P&gt;&lt;P&gt;1034 OPSEG 5 303.253 19991231 20001231&lt;/P&gt;&lt;P&gt;1034 OPSEG 6 60.806 19991231 20001231&lt;/P&gt;&lt;P&gt;1034 OPSEG 7 169.194 19991231 20001231&lt;/P&gt;&lt;P&gt;1034 OPSEG 8 16.051 19991231 20001231&lt;/P&gt;&lt;P&gt;1034 OPSEG 9 0 19991231 20001231&lt;/P&gt;&lt;P&gt;1034 OPSEG 99 -4.429 19991231 20001231&lt;/P&gt;&lt;P&gt;1035 OPSEG 10 159.079 19991231 20011231&lt;/P&gt;&lt;P&gt;1035 OPSEG 99 -4.429 19991231 20011231&lt;/P&gt;&lt;P&gt;1035 OPSEG 4 233.008 20001231 20001231&lt;/P&gt;&lt;P&gt;1035 OPSEG 5 309.296 20001231 20001231&lt;/P&gt;&lt;P&gt;1035 OPSEG 6 62.692 20001231 20001231&lt;/P&gt;&lt;P&gt;1035 OPSEG 7 305.714 20001231 20001231&lt;/P&gt;&lt;P&gt;1035 OPSEG 8 13.903 20001231 20011231&lt;/P&gt;&lt;P&gt;1035 OPSEG 9 0 20001231 20011231&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;expected results:&lt;/P&gt;&lt;P&gt;GVKEY STYPE SID SALES datadate srcdate&lt;/P&gt;&lt;P&gt;1034 OPSEG 4 197.301 19991231 20001231&lt;/P&gt;&lt;P&gt;1034 OPSEG 5 303.253 19991231 20001231&lt;/P&gt;&lt;P&gt;1034 OPSEG 6 60.806 19991231 20001231&lt;/P&gt;&lt;P&gt;1034 OPSEG 7 169.194 19991231 20001231&lt;/P&gt;&lt;P&gt;1034 OPSEG 8 16.051 19991231 20001231&lt;/P&gt;&lt;P&gt;1034 OPSEG 9 0 19991231 20001231&lt;/P&gt;&lt;P&gt;1034 OPSEG 99 -4.429 19991231 20001231&lt;/P&gt;&lt;P&gt;1035 OPSEG 10 159.079 19991231 20011231&lt;/P&gt;&lt;P&gt;1035 OPSEG 8 13.903 20001231 20011231&lt;/P&gt;&lt;P&gt;1035 OPSEG 9 0 20001231 20011231&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to use something like&lt;BR /&gt;proc sort data=TestData;&lt;/P&gt;&lt;P&gt;by gvkey sid srcdate;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;set TestData;&lt;BR /&gt;by gvkey sid srcdate;&lt;BR /&gt;if last.???;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help and Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Mar 2013 22:55:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131744#M26824</guid>
      <dc:creator>LanMin</dc:creator>
      <dc:date>2013-03-09T22:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: if last.group then output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131745#M26825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to explain why so many of the 1035 records aren't kept.&amp;nbsp; Using if last.sid provides the desired results for the 1034 records.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Mar 2013 23:31:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131745#M26825</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-03-09T23:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: if last.group then output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131746#M26826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Arthur and other community memebers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the reason many of of the 1035 records aren't kept is that, I want to cmpare datadate with srcdate, for each datadate, only rows of the latest srcdate rows are kept.&lt;/P&gt;&lt;P&gt;think of datadate as the historical year, datadate=&lt;SPAN style="color: black; font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;19991231, firm 1035 has 2 operseg , and the dataserver recorded such information on&amp;nbsp; srcdate=20001231&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;for&amp;nbsp; firm 1035 datadate=20001231, this firm's records were recorded two times, once on&amp;nbsp; srcdate=20001231, second time, on&amp;nbsp; srcdate=20011231, which is an update. I want to keep only the updated information for each firm, keep the latest records.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;Please help with coding!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-family: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman';"&gt;Lan&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Mar 2013 13:12:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131746#M26826</guid>
      <dc:creator>LanMin</dc:creator>
      <dc:date>2013-03-10T13:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: if last.group then output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131747#M26827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you saying that you want the last record if, and only if, datadate is less than srcdate?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If so, then the following should work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set TestData;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by gvkey sid;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if last.sid and datadate lt srcdate;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Mar 2013 13:55:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131747#M26827</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-03-10T13:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: if last.group then output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131748#M26828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Arthur,&lt;/P&gt;&lt;P&gt;I want to keep the last records (based on srcdate) for each appearance of datadate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so if&lt;/P&gt;&lt;P&gt;obs datadate srcdate&lt;/P&gt;&lt;P&gt;1 19991231 20011231&lt;/P&gt;&lt;P&gt;2 19991231 20011231&lt;/P&gt;&lt;P&gt;3 20001231 20001231&lt;/P&gt;&lt;P&gt;4 20001231 20001231&lt;/P&gt;&lt;P&gt;5 20001231 20001231&lt;/P&gt;&lt;P&gt;6 20001231 20001231&lt;/P&gt;&lt;P&gt;7 20001231 20011231&lt;/P&gt;&lt;P&gt;8 20001231 20011231&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need tokeep obs 1,2, 7 and 8.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;using my original posting data:&lt;/P&gt;&lt;P&gt;for firm 1035 I also want to keep these 2 rows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1035 OPSEG 10 159.079 19991231 20011231&lt;/P&gt;&lt;P&gt;1035 OPSEG 99 -4.429 19991231 20011231&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;that is the data want should look like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GVKEY STYPE SID SALES datadate srcdate&lt;/P&gt;&lt;P&gt;1034 OPSEG 4 197.301 19991231 20001231&lt;/P&gt;&lt;P&gt;1034 OPSEG 5 303.253 19991231 20001231&lt;/P&gt;&lt;P&gt;1034 OPSEG 6 60.806 19991231 20001231&lt;/P&gt;&lt;P&gt;1034 OPSEG 7 169.194 19991231 20001231&lt;/P&gt;&lt;P&gt;1034 OPSEG 8 16.051 19991231 20001231&lt;/P&gt;&lt;P&gt;1034 OPSEG 9 0 19991231 20001231&lt;/P&gt;&lt;P&gt;1034 OPSEG 99 -4.429 19991231 20001231&lt;/P&gt;&lt;P&gt;1035 OPSEG 10 159.079 19991231 20011231&lt;/P&gt;&lt;P&gt;1035 OPSEG 10 159.079 19991231 20011231&lt;/P&gt;&lt;P&gt;1035 OPSEG 99 -4.429 19991231 20011231&lt;/P&gt;&lt;P&gt;1035 OPSEG 8 13.903 20001231 20011231&lt;/P&gt;&lt;P&gt;1035 OPSEG 9 0 20001231 20011231&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;using your code, I will not have&lt;/P&gt;&lt;P&gt;1035 OPSEG 10 159.079 19991231 20011231&lt;/P&gt;&lt;P&gt;1035 OPSEG 99 -4.429 19991231 20011231&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Mar 2013 16:22:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131748#M26828</guid>
      <dc:creator>LanMin</dc:creator>
      <dc:date>2013-03-10T16:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: if last.group then output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131749#M26829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, I think the code I originally suggested did give you those records, although possibly for the wrong reasons.&amp;nbsp; I still don't understand what you are trying to accomplish (i.e., I don't understand your rules) and your stated desired output has an extra record in it now (for gvkey 1035, sid 10).&amp;nbsp; Does the following do what you want?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=TestData;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by gvkey datadate srcdate;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data want (drop=maxdate);&lt;/P&gt;&lt;P&gt;&amp;nbsp; do until(last.datadate);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set TestData;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; format maxdate date9.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by gvkey datadate;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if last.datadate then maxdate=srcdate;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do until(last.datadate);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set TestData;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by gvkey datadate;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if srcdate eq maxdate then output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Mar 2013 17:35:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131749#M26829</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-03-10T17:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: if last.group then output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131750#M26830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does not sounds like you want LAST. processing at all. Instead you want to select all records that have the maximum value of SRCDATE.&amp;nbsp; I am still a little unclear on what your other grouping variables are.&amp;nbsp; It seems clear that GVKEY and DATADATE are important, but it is no clear whether STYPE is a grouping variable or not because it is a constant in your sample data.&amp;nbsp; This query should do what want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc sql noprint ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;create table want as&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; select * &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; from have&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; group by gvkey, stype, datadate&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; having srcdate = max(srcdate)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it also selects the observation where GVKEY=1035 and SID=99 because it has the same DATADATE and SRCDATE as the one with SID=10.&amp;nbsp; Perhaps that was on oversight in your original listing of the expected output?&amp;nbsp; Or is there another rule that would exclude that observation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Mar 2013 02:55:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131750#M26830</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-03-11T02:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: if last.group then output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131751#M26831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot, Tom!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;your code works great!&amp;nbsp; you are correct, stype is not a grouping variable. I am not proficient with SAS, therefore, the first thing that came to mind is to use last.group to get the latest scrdate records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW, if anyone has recommendation for good sas programming book, please share. I read little sas book, but that is not enough.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks to all of you,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Mar 2013 17:45:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131751#M26831</guid>
      <dc:creator>LanMin</dc:creator>
      <dc:date>2013-03-11T17:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: if last.group then output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131752#M26832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can actually accomplish this via sorting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=TestData;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by gvkey datadate descending srcdate;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort in=TestData out=TestData_Srt nodupkey;&lt;/P&gt;&lt;P&gt;by gvkey datadate;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Mar 2013 18:01:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-last-group-then-output/m-p/131752#M26832</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2013-03-11T18:01:14Z</dc:date>
    </item>
  </channel>
</rss>

