<?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 finding if an observation happened before a reference date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/finding-if-an-observation-happened-before-a-reference-date/m-p/249891#M47074</link>
    <description>&lt;P&gt;&amp;nbsp;I have the following data, multiple observation per id. several s_Date, one adm_date per id,&lt;/P&gt;&lt;P&gt;I want to do the following: if hf=1 and the s_date is before adm_date then delete all observation for that id.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;id &amp;nbsp; &amp;nbsp; &amp;nbsp; s_date &amp;nbsp;         hf &amp;nbsp; &amp;nbsp; &amp;nbsp;adm_Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
1 &amp;nbsp;&amp;nbsp;     1/1/2005       1       2/2/2004
1        7/7/2005       0
2        4/3/2004       0
2       2/2/2005        1       6/7/2005
2                       0
3                       0
3       4/4/2006        1     8/8/2005
3&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 13 Feb 2016 21:16:11 GMT</pubDate>
    <dc:creator>lillymaginta</dc:creator>
    <dc:date>2016-02-13T21:16:11Z</dc:date>
    <item>
      <title>finding if an observation happened before a reference date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-if-an-observation-happened-before-a-reference-date/m-p/249891#M47074</link>
      <description>&lt;P&gt;&amp;nbsp;I have the following data, multiple observation per id. several s_Date, one adm_date per id,&lt;/P&gt;&lt;P&gt;I want to do the following: if hf=1 and the s_date is before adm_date then delete all observation for that id.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;id &amp;nbsp; &amp;nbsp; &amp;nbsp; s_date &amp;nbsp;         hf &amp;nbsp; &amp;nbsp; &amp;nbsp;adm_Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
1 &amp;nbsp;&amp;nbsp;     1/1/2005       1       2/2/2004
1        7/7/2005       0
2        4/3/2004       0
2       2/2/2005        1       6/7/2005
2                       0
3                       0
3       4/4/2006        1     8/8/2005
3&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2016 21:16:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-if-an-observation-happened-before-a-reference-date/m-p/249891#M47074</guid>
      <dc:creator>lillymaginta</dc:creator>
      <dc:date>2016-02-13T21:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: finding if an observation happened before a reference date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-if-an-observation-happened-before-a-reference-date/m-p/249902#M47075</link>
      <description>&lt;P&gt;Is there will always be only one hf=1 per id?&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2016 23:23:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-if-an-observation-happened-before-a-reference-date/m-p/249902#M47075</guid>
      <dc:creator>mohamed_zaki</dc:creator>
      <dc:date>2016-02-13T23:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: finding if an observation happened before a reference date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-if-an-observation-happened-before-a-reference-date/m-p/249906#M47076</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id s_date ddmmyy9. hf adm_Date ddmmyy9.;
cards;
1 1/1/2005 1 2/2/2004
1 7/7/2005 0 .
2 4/3/2004 0 .
2 2/2/2005 1 6/7/2005
2 . 0 .
3 . 0 .
3 4/4/2006 1 8/8/2005
;
run;

proc sql ;
create table want as
select *
from have
where id not in (select distinct id from have where s_date &amp;lt; adm_date and hf=1)
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 14 Feb 2016 00:40:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-if-an-observation-happened-before-a-reference-date/m-p/249906#M47076</guid>
      <dc:creator>mohamed_zaki</dc:creator>
      <dc:date>2016-02-14T00:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: finding if an observation happened before a reference date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-if-an-observation-happened-before-a-reference-date/m-p/249911#M47078</link>
      <description>&lt;P&gt;proc sql;&lt;BR /&gt;create table want as&lt;BR /&gt;select * from have&lt;BR /&gt;group by id&lt;BR /&gt;having sum(case when s_date&amp;lt;adm_date and hf=1 then 1 else 0 end)=0;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Feb 2016 00:36:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-if-an-observation-happened-before-a-reference-date/m-p/249911#M47078</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2016-02-14T00:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: finding if an observation happened before a reference date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-if-an-observation-happened-before-a-reference-date/m-p/249919#M47082</link>
      <description>Thank you Mohamed asnd stat_sas both codes worked and produced the same results. I appreciate it</description>
      <pubDate>Sun, 14 Feb 2016 01:44:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-if-an-observation-happened-before-a-reference-date/m-p/249919#M47082</guid>
      <dc:creator>lillymaginta</dc:creator>
      <dc:date>2016-02-14T01:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: finding if an observation happened before a reference date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-if-an-observation-happened-before-a-reference-date/m-p/249920#M47083</link>
      <description>&lt;P&gt;yes one hf per id&lt;/P&gt;</description>
      <pubDate>Sun, 14 Feb 2016 01:44:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-if-an-observation-happened-before-a-reference-date/m-p/249920#M47083</guid>
      <dc:creator>lillymaginta</dc:creator>
      <dc:date>2016-02-14T01:44:43Z</dc:date>
    </item>
  </channel>
</rss>

