<?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: Proc SQL linking on dates 1 day apart? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-linking-on-dates-1-day-apart/m-p/396544#M95755</link>
    <description>&lt;P&gt;Try the join condition&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;on a.HCN = b.HCN &lt;BR /&gt;and a.admdate between b.enddate and b.enddate+1&lt;/P&gt;</description>
    <pubDate>Sat, 16 Sep 2017 05:17:09 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2017-09-16T05:17:09Z</dc:date>
    <item>
      <title>Proc SQL linking on dates 1 day apart?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-linking-on-dates-1-day-apart/m-p/396541#M95754</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using SAS 9.3.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have inpatient and outpatient data.&amp;nbsp; I want to link the Emergency Room abstract with the inpatient one for those admitted via the ER.&amp;nbsp; However, the admit date of the inpatient visit could be a day later than the end date of the ER abstract.&amp;nbsp; Is there any way to do this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The ED table only has those visits admitted and the inpatient cases only have those admitted via the ED.&amp;nbsp; The current resulting dataset is missing out on those where the ED end date is a day later i.e. the inpatient admit date is April 10, 2017 and the ED end date is April 11, 2017.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My current code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table Links as select
a.HCN,
a.alias,
a.admdate,
b.regdate,
b.triage
from inpatients as a
left join ED as b
on a.HCN = b.HCN 
and b.enddate&amp;lt;=a.admdate&amp;lt;=b.enddate+1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Any and all assistance greatly appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 04:11:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-linking-on-dates-1-day-apart/m-p/396541#M95754</guid>
      <dc:creator>shellp55</dc:creator>
      <dc:date>2017-09-16T04:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL linking on dates 1 day apart?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-linking-on-dates-1-day-apart/m-p/396544#M95755</link>
      <description>&lt;P&gt;Try the join condition&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;on a.HCN = b.HCN &lt;BR /&gt;and a.admdate between b.enddate and b.enddate+1&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 05:17:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-linking-on-dates-1-day-apart/m-p/396544#M95755</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-09-16T05:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL linking on dates 1 day apart?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-linking-on-dates-1-day-apart/m-p/396545#M95756</link>
      <description>&lt;P&gt;Is it a date or date time variable? I thought it was usually DT. It's also really rare but it can be longer than a day.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 06:08:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-linking-on-dates-1-day-apart/m-p/396545#M95756</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-16T06:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL linking on dates 1 day apart?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-linking-on-dates-1-day-apart/m-p/396578#M95764</link>
      <description>&lt;P&gt;Thanks to you both for responding.&amp;nbsp; I worked on it last night and I created a new field called "d_date" that was the +1 and added as an OR statement.&amp;nbsp; So PGStats response but instead of using "+1" I built that as a field elsewhere.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks so much!&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 17:54:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-linking-on-dates-1-day-apart/m-p/396578#M95764</guid>
      <dc:creator>shellp55</dc:creator>
      <dc:date>2017-09-16T17:54:55Z</dc:date>
    </item>
  </channel>
</rss>

