<?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: How can I only get the last row that is grouped by 2 variables? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-only-get-the-last-row-that-is-grouped-by-2-variables/m-p/805130#M317113</link>
    <description>&lt;P&gt;that was easier than I thought. Thanks!&lt;/P&gt;</description>
    <pubDate>Wed, 30 Mar 2022 19:07:16 GMT</pubDate>
    <dc:creator>aalluru</dc:creator>
    <dc:date>2022-03-30T19:07:16Z</dc:date>
    <item>
      <title>How can I only get the last row that is grouped by 2 variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-only-get-the-last-row-that-is-grouped-by-2-variables/m-p/805126#M317110</link>
      <description>&lt;P&gt;I have the following data:&lt;/P&gt;
&lt;P&gt;ID Flag Date Details&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp;N&amp;nbsp; &amp;nbsp; &amp;nbsp;1/1&amp;nbsp; &amp;nbsp; abc&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp;N&amp;nbsp; &amp;nbsp; &amp;nbsp;1/2&amp;nbsp; &amp;nbsp; efg&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp;Y&amp;nbsp; &amp;nbsp; &amp;nbsp;1/1&amp;nbsp; &amp;nbsp; hij&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp;N&amp;nbsp; &amp;nbsp; 1/3&amp;nbsp; &amp;nbsp; &amp;nbsp;lmo&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This dataset is already sorted by ID, flag and date (ascending order) using proc sort. I want to now only output the last row in every ID, flag combination as follows:&lt;/P&gt;
&lt;P&gt;ID Flag Date Details&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp;N&amp;nbsp; &amp;nbsp; 1/2&amp;nbsp; &amp;nbsp; &amp;nbsp;efg&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp;Y&amp;nbsp; &amp;nbsp; 1/1&amp;nbsp; &amp;nbsp; &amp;nbsp;hij&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp;N&amp;nbsp; &amp;nbsp; 1/3&amp;nbsp; &amp;nbsp; lmo&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 18:51:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-only-get-the-last-row-that-is-grouped-by-2-variables/m-p/805126#M317110</guid>
      <dc:creator>aalluru</dc:creator>
      <dc:date>2022-03-30T18:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: How can I only get the last row that is grouped by 2 variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-only-get-the-last-row-that-is-grouped-by-2-variables/m-p/805129#M317112</link>
      <description>&lt;P&gt;Just use BY group processing.&amp;nbsp; You want the last one per ID FLAG group.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  by ID Flag Date;
  if last.flag;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Mar 2022 19:04:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-only-get-the-last-row-that-is-grouped-by-2-variables/m-p/805129#M317112</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-03-30T19:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: How can I only get the last row that is grouped by 2 variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-only-get-the-last-row-that-is-grouped-by-2-variables/m-p/805130#M317113</link>
      <description>&lt;P&gt;that was easier than I thought. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 19:07:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-only-get-the-last-row-that-is-grouped-by-2-variables/m-p/805130#M317113</guid>
      <dc:creator>aalluru</dc:creator>
      <dc:date>2022-03-30T19:07:16Z</dc:date>
    </item>
  </channel>
</rss>

