<?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 get the last row of a group with a condition in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/get-the-last-row-of-a-group-with-a-condition/m-p/702852#M215292</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I need to create a&amp;nbsp;flag. the value should be 1 onfly for the last date among the staus S. here, only the row 3&lt;/P&gt;
&lt;P&gt;thanks for your help&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input client date status $ ;
informat date date9.;
format date date9.;
datalines ;
12345 10NOV2020 A
12345 11NOV2020 S
12345 12NOV2020 S
12345 12NOV2020 B
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 01 Dec 2020 17:54:34 GMT</pubDate>
    <dc:creator>Nasser_DRMCP</dc:creator>
    <dc:date>2020-12-01T17:54:34Z</dc:date>
    <item>
      <title>get the last row of a group with a condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-the-last-row-of-a-group-with-a-condition/m-p/702852#M215292</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I need to create a&amp;nbsp;flag. the value should be 1 onfly for the last date among the staus S. here, only the row 3&lt;/P&gt;
&lt;P&gt;thanks for your help&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input client date status $ ;
informat date date9.;
format date date9.;
datalines ;
12345 10NOV2020 A
12345 11NOV2020 S
12345 12NOV2020 S
12345 12NOV2020 B
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 Dec 2020 17:54:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-the-last-row-of-a-group-with-a-condition/m-p/702852#M215292</guid>
      <dc:creator>Nasser_DRMCP</dc:creator>
      <dc:date>2020-12-01T17:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: get the last row of a group with a condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-the-last-row-of-a-group-with-a-condition/m-p/702858#M215293</link>
      <description>&lt;P&gt;I get the feeling that the problem contains more elements than you told us. Are there more than one client? If yes, what do we do in that case? Is the data always properly sorted? Can we sort the data in order to produce the flag you want?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you show us a data set that illustrates the issues in the real data?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 18:03:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-the-last-row-of-a-group-with-a-condition/m-p/702858#M215293</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-12-01T18:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: get the last row of a group with a condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-the-last-row-of-a-group-with-a-condition/m-p/702861#M215294</link>
      <description>&lt;P&gt;Please clarify the rule: Are you saying that the last date with a status of S should be flagged 1? And should that be by client? If you would provide an expanded/more extensive example, that would help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know what your data represents, but what if, for example, this was the input data. Which records should be flagged?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
input client date status $ ;
informat date date9.;
format date date9.;
datalines ;
12345 10NOV2020 A
12345 11NOV2020 S
12345 12NOV2020 S
12345 12NOV2020 B
12345 13NOV2020 S
23456 13NOV2020 S
34567 10NOV2020 S
34567 10NOV2020 B
34567 11NOV2020 S 
;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 18:13:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-the-last-row-of-a-group-with-a-condition/m-p/702861#M215294</guid>
      <dc:creator>mklangley</dc:creator>
      <dc:date>2020-12-01T18:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: get the last row of a group with a condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-the-last-row-of-a-group-with-a-condition/m-p/702863#M215296</link>
      <description>&lt;P&gt;Leapfrogging on&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;'s questions, I'll assume that the data are sorted by client/date.&amp;nbsp; If so, then:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input client date status $ ;
informat date date9.;
format date date9.;
datalines ;
12345 10NOV2020 A
12345 11NOV2020 S
12345 12NOV2020 S
12345 12NOV2020 B
;
data want (drop=_:);
  set have (where=(status='S')  in=ins) have (in=keep);
  by client;
  if first.client then call missing(_last_s_date);
  if ins then _last_s_date=date;
  retain _last_s_date;
  if keep;
  if date=_last_s_date and status='S' then flag=1;
  else flag=0;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This program, for each client, "pre-reads" all the S status records and keeps the most recent date.&amp;nbsp; Then it reads all the records for the same client, it sets the flag when re-reading of the identified record.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 18:38:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-the-last-row-of-a-group-with-a-condition/m-p/702863#M215296</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-12-01T18:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: get the last row of a group with a condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-the-last-row-of-a-group-with-a-condition/m-p/702864#M215297</link>
      <description>&lt;P&gt;For What It's Worth, my share of fun-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

data have;
input client date status $ ;
informat date date9.;
format date date9.;
datalines ;
12345 10NOV2020 A
12345 11NOV2020 S
12345 12NOV2020 S
12345 12NOV2020 B
;

proc sql;
 create table want as
 select *, status='S' and max(date)=date as flag
 from have
 group by client,status
 order by client, date;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 Dec 2020 18:25:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-the-last-row-of-a-group-with-a-condition/m-p/702864#M215297</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-12-01T18:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: get the last row of a group with a condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-the-last-row-of-a-group-with-a-condition/m-p/703039#M215389</link>
      <description>&lt;P&gt;&lt;EM&gt;Hello,&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;thanks for your quick respons&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;I am sorry, I figure out that I should clarify my problem.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;I need to flag the last status S for each&amp;nbsp;client and each day&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;in this new dataset with date and time, what I want is :&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;for the day 10NOV==&amp;gt;flag to 0&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;for the day 11NOV==&amp;gt;flag to 1&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;for the day 12NOV==&amp;gt;flag to 1 only for line 12:13:13&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; client date :&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;datetime18.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; status $ ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;informat&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; date &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;datetime20.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; date &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;datetime20.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;12345 10NOV2020:10:10:10 A&lt;/P&gt;
&lt;P&gt;12345 11NOV2020:11:11:11 S&lt;/P&gt;
&lt;P&gt;12345 12NOV2020:12:12:12 S&lt;/P&gt;
&lt;P&gt;12345 12NOV2020:12:13:13 S&lt;/P&gt;
&lt;P&gt;12345 12NOV2020:12:14:14 A&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 09:14:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-the-last-row-of-a-group-with-a-condition/m-p/703039#M215389</guid>
      <dc:creator>Nasser_DRMCP</dc:creator>
      <dc:date>2020-12-02T09:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: get the last row of a group with a condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-the-last-row-of-a-group-with-a-condition/m-p/703042#M215391</link>
      <description>thanks  mkeintz&lt;BR /&gt;I have clarified my problem. I hope it is clearer .&lt;BR /&gt;I do not manage to implement your suggestion&lt;BR /&gt;thanks for your help</description>
      <pubDate>Wed, 02 Dec 2020 09:44:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-the-last-row-of-a-group-with-a-condition/m-p/703042#M215391</guid>
      <dc:creator>Nasser_DRMCP</dc:creator>
      <dc:date>2020-12-02T09:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: get the last row of a group with a condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-the-last-row-of-a-group-with-a-condition/m-p/703046#M215394</link>
      <description>&lt;P&gt;thanks to your help, the solution is&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; client date &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; datetime &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;datetime20.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; status $ ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;informat&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; datetime &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;datetime20.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; datetime &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;datetime20.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; date &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;date9.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;12345 10NOV2020 10NOV2020:10:10:10 A&lt;/P&gt;
&lt;P&gt;12345 11NOV2020 11NOV2020:11:11:11 S&lt;/P&gt;
&lt;P&gt;12345 12NOV2020 12NOV2020:12:12:12 S&lt;/P&gt;
&lt;P&gt;12345 12NOV2020 12NOV2020:12:13:13 S&lt;/P&gt;
&lt;P&gt;12345 12NOV2020 12NOV2020:12:14:14 A&lt;/P&gt;
&lt;P&gt;92345 10NOV2020 10NOV2020:10:10:10 A&lt;/P&gt;
&lt;P&gt;92345 11NOV2020 11NOV2020:11:11:11 S&lt;/P&gt;
&lt;P&gt;92345 12NOV2020 12NOV2020:12:12:12 S&lt;/P&gt;
&lt;P&gt;92345 12NOV2020 12NOV2020:12:13:13 S&lt;/P&gt;
&lt;P&gt;92345 12NOV2020 12NOV2020:12:14:14 A&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;sort&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=have; &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; client datetime ;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; want (&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;drop&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=_:);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have (&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=(status=&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'S'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;) &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;in&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=ins) have (&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;in&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=keep);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; client;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; first.client &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;then&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;call&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; missing(_last_s_date);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ins &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; _last_s_date=date;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;retain&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; _last_s_date;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; keep;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; date=_last_s_date &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;and&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; status=&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'S'&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; flag=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;else&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; flag=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; want(&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;drop&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=_:) ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;format&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; _last_s_datetime &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;datetime20.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have (&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=(status=&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'S'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;) &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;in&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=ins) have (&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;in&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=keep);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; client date ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; first.datetime &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;then&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;call&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; missing(_last_s_datetime);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ins &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; _last_s_datetime=datetime;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;retain&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; _last_s_datetime;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; keep;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; datetime=_last_s_datetime &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;and&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; status=&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;'S'&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; flag=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;else&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; flag=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 10:05:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-the-last-row-of-a-group-with-a-condition/m-p/703046#M215394</guid>
      <dc:creator>Nasser_DRMCP</dc:creator>
      <dc:date>2020-12-02T10:05:54Z</dc:date>
    </item>
  </channel>
</rss>

