<?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 Exclude records with id in output  based on date and status in SAS Health and Life Sciences</title>
    <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Exclude-records-with-id-in-output-based-on-date-and-status/m-p/72632#M1663</link>
    <description>I'm learning sas......Trying to do below example....Please suggest me how to do it.&lt;BR /&gt;
Pls post the code.&lt;BR /&gt;
&lt;BR /&gt;
 Below is the sample data.&lt;BR /&gt;
&lt;BR /&gt;
input:&lt;BR /&gt;
&lt;BR /&gt;
 id   date           status     days&lt;BR /&gt;
112  03/02/09   Approved    4&lt;BR /&gt;
112  03/03/09   Refferal      3&lt;BR /&gt;
112  03/04/09   shipped     2&lt;BR /&gt;
112  03/06/09   shipped     3&lt;BR /&gt;
113  04/01/08   Refferal      2&lt;BR /&gt;
113  04/02/09   Approved    1&lt;BR /&gt;
113  04/03/09   Ahipped     1&lt;BR /&gt;
&lt;BR /&gt;
I want to exclude the recordswith perticular id  in output,if first date status is not equal to refferal.&lt;BR /&gt;
&lt;BR /&gt;
Output:&lt;BR /&gt;
&lt;BR /&gt;
id   date       status     days&lt;BR /&gt;
113  04/01/08   Refferal    2&lt;BR /&gt;
113  04/02/09   Approved    1&lt;BR /&gt;
113  04/03/09   Ahipped     1&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
sasg</description>
    <pubDate>Fri, 03 Jun 2011 21:37:27 GMT</pubDate>
    <dc:creator>sasg</dc:creator>
    <dc:date>2011-06-03T21:37:27Z</dc:date>
    <item>
      <title>Exclude records with id in output  based on date and status</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Exclude-records-with-id-in-output-based-on-date-and-status/m-p/72632#M1663</link>
      <description>I'm learning sas......Trying to do below example....Please suggest me how to do it.&lt;BR /&gt;
Pls post the code.&lt;BR /&gt;
&lt;BR /&gt;
 Below is the sample data.&lt;BR /&gt;
&lt;BR /&gt;
input:&lt;BR /&gt;
&lt;BR /&gt;
 id   date           status     days&lt;BR /&gt;
112  03/02/09   Approved    4&lt;BR /&gt;
112  03/03/09   Refferal      3&lt;BR /&gt;
112  03/04/09   shipped     2&lt;BR /&gt;
112  03/06/09   shipped     3&lt;BR /&gt;
113  04/01/08   Refferal      2&lt;BR /&gt;
113  04/02/09   Approved    1&lt;BR /&gt;
113  04/03/09   Ahipped     1&lt;BR /&gt;
&lt;BR /&gt;
I want to exclude the recordswith perticular id  in output,if first date status is not equal to refferal.&lt;BR /&gt;
&lt;BR /&gt;
Output:&lt;BR /&gt;
&lt;BR /&gt;
id   date       status     days&lt;BR /&gt;
113  04/01/08   Refferal    2&lt;BR /&gt;
113  04/02/09   Approved    1&lt;BR /&gt;
113  04/03/09   Ahipped     1&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
sasg</description>
      <pubDate>Fri, 03 Jun 2011 21:37:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Exclude-records-with-id-in-output-based-on-date-and-status/m-p/72632#M1663</guid>
      <dc:creator>sasg</dc:creator>
      <dc:date>2011-06-03T21:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude records with id in output  based on date and status</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Exclude-records-with-id-in-output-based-on-date-and-status/m-p/72633#M1664</link>
      <description>Hello SASG,&lt;BR /&gt;
&lt;BR /&gt;
This is a solution:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data i;&lt;BR /&gt;
  input id date ANYDTDTE9. status $ days;&lt;BR /&gt;
  format date date7.;&lt;BR /&gt;
datalines;&lt;BR /&gt;
112 03/02/09 Approved 4&lt;BR /&gt;
112 03/03/09 Refferal 3&lt;BR /&gt;
112 03/04/09 shipped  2&lt;BR /&gt;
112 03/06/09 shipped  3&lt;BR /&gt;
113 04/01/08 Refferal 2&lt;BR /&gt;
113 04/02/09 Approved 1&lt;BR /&gt;
113 04/03/09 Ahipped  1&lt;BR /&gt;
run;&lt;BR /&gt;
proc sort data=i;&lt;BR /&gt;
  by id date;&lt;BR /&gt;
run;&lt;BR /&gt;
data r;&lt;BR /&gt;
  retain drop;&lt;BR /&gt;
  set i;&lt;BR /&gt;
  if FIRST.id then drop=0;&lt;BR /&gt;
  if FIRST.id and UPCASE(status) NE "REFFERAL" then drop=1;&lt;BR /&gt;
  if drop=0 then output;&lt;BR /&gt;
  by id;&lt;BR /&gt;
  drop drop;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
      <pubDate>Mon, 06 Jun 2011 16:10:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Exclude-records-with-id-in-output-based-on-date-and-status/m-p/72633#M1664</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2011-06-06T16:10:12Z</dc:date>
    </item>
  </channel>
</rss>

