<?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: Join tables, Date in between check in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Join-tables-Date-in-between-check/m-p/669947#M201053</link>
    <description>Thank you! I knew it was easy.</description>
    <pubDate>Thu, 16 Jul 2020 18:06:19 GMT</pubDate>
    <dc:creator>anweinbe</dc:creator>
    <dc:date>2020-07-16T18:06:19Z</dc:date>
    <item>
      <title>Join tables, Date in between check</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-tables-Date-in-between-check/m-p/669940#M201049</link>
      <description>&lt;P&gt;Good afternoon SAS friends. I could use a little help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have one table: Temp.a, that has an Employee ID number and a Hire Date. I have another file Temp.B that has an ID number and a Beginning Date and an End Date as well as some other information. Our company recycles ID's.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to join the files together on Employee ID, but add a clause where the Hire Date must be between the beginning date and end date. That will ensure it matches to the right record in the second table. In the example below, I would want my table 1 to match to the 2nd record of table 2, not the first.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Table 1:&amp;nbsp; &amp;nbsp; 123456&amp;nbsp; &amp;nbsp; &amp;nbsp;10/23/2019&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Table 2:&amp;nbsp; &amp;nbsp; 123456&amp;nbsp; &amp;nbsp; &amp;nbsp; 01/01/2010&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12/31/2018&lt;/P&gt;
&lt;P&gt;Table 2:&amp;nbsp; &amp;nbsp; &amp;nbsp;123456&amp;nbsp; &amp;nbsp; &amp;nbsp; 01/01/2019&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12/31/2019&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can write the typical join statement... but I figure I need to add something to this...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;where a.empno=b.empno;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;THANK YOU!!!!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 17:53:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-tables-Date-in-between-check/m-p/669940#M201049</guid>
      <dc:creator>anweinbe</dc:creator>
      <dc:date>2020-07-16T17:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: Join tables, Date in between check</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-tables-Date-in-between-check/m-p/669945#M201051</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where a.empno=b.empno and a.date between b.BeginningDate and b.EndDate&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;Something like that? it includes the endpoints of your intervals though, if you don't want to include the dates in the interval use greater than and less than calculations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/287480"&gt;@anweinbe&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Good afternoon SAS friends. I could use a little help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have one table: Temp.a, that has an Employee ID number and a Hire Date. I have another file Temp.B that has an ID number and a Beginning Date and an End Date as well as some other information. Our company recycles ID's.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to join the files together on Employee ID, but add a clause where the Hire Date must be between the beginning date and end date. That will ensure it matches to the right record in the second table. In the example below, I would want my table 1 to match to the 2nd record of table 2, not the first.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Table 1:&amp;nbsp; &amp;nbsp; 123456&amp;nbsp; &amp;nbsp; &amp;nbsp;10/23/2019&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Table 2:&amp;nbsp; &amp;nbsp; 123456&amp;nbsp; &amp;nbsp; &amp;nbsp; 01/01/2010&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12/31/2018&lt;/P&gt;
&lt;P&gt;Table 2:&amp;nbsp; &amp;nbsp; &amp;nbsp;123456&amp;nbsp; &amp;nbsp; &amp;nbsp; 01/01/2019&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12/31/2019&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can write the typical join statement... but I figure I need to add something to this...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;where a.empno=b.empno;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;THANK YOU!!!!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 18:01:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-tables-Date-in-between-check/m-p/669945#M201051</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-07-16T18:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: Join tables, Date in between check</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Join-tables-Date-in-between-check/m-p/669947#M201053</link>
      <description>Thank you! I knew it was easy.</description>
      <pubDate>Thu, 16 Jul 2020 18:06:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Join-tables-Date-in-between-check/m-p/669947#M201053</guid>
      <dc:creator>anweinbe</dc:creator>
      <dc:date>2020-07-16T18:06:19Z</dc:date>
    </item>
  </channel>
</rss>

