<?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 proc sql, join on multiple conditions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-join-on-multiple-conditions/m-p/265186#M52117</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to join two tables using left join, which is a one to mutiple joins based on the two conditions, however the date condition was not applied. &amp;nbsp;I am wondering what is the reason. &amp;nbsp;Thank you !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table temp1 as&lt;BR /&gt;select a.PatientID, a.AdministeredDate,&amp;nbsp;&lt;BR /&gt;b.TestDate, b.TestResult, (a.AdministeredDate -b.testdate) as dif_admin_test&lt;BR /&gt;from admindate as a&lt;BR /&gt;left join wgt as b&lt;BR /&gt;on a.patientid = b.patientid and (a.AdministeredDate -b.testdate) &amp;lt;= 7&lt;BR /&gt;order by patientid, AdministeredDate, TestDate;&lt;BR /&gt;quit;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Apr 2016 18:01:10 GMT</pubDate>
    <dc:creator>Ivy</dc:creator>
    <dc:date>2016-04-20T18:01:10Z</dc:date>
    <item>
      <title>proc sql, join on multiple conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-join-on-multiple-conditions/m-p/265186#M52117</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to join two tables using left join, which is a one to mutiple joins based on the two conditions, however the date condition was not applied. &amp;nbsp;I am wondering what is the reason. &amp;nbsp;Thank you !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table temp1 as&lt;BR /&gt;select a.PatientID, a.AdministeredDate,&amp;nbsp;&lt;BR /&gt;b.TestDate, b.TestResult, (a.AdministeredDate -b.testdate) as dif_admin_test&lt;BR /&gt;from admindate as a&lt;BR /&gt;left join wgt as b&lt;BR /&gt;on a.patientid = b.patientid and (a.AdministeredDate -b.testdate) &amp;lt;= 7&lt;BR /&gt;order by patientid, AdministeredDate, TestDate;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 18:01:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-join-on-multiple-conditions/m-p/265186#M52117</guid>
      <dc:creator>Ivy</dc:creator>
      <dc:date>2016-04-20T18:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql, join on multiple conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-join-on-multiple-conditions/m-p/265188#M52118</link>
      <description>Find the answers, I should use:&lt;BR /&gt;&lt;BR /&gt;0&amp;lt;= (a.AdministeredDate -b.testdate) &amp;lt;= 7&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 20 Apr 2016 18:07:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-join-on-multiple-conditions/m-p/265188#M52118</guid>
      <dc:creator>Ivy</dc:creator>
      <dc:date>2016-04-20T18:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql, join on multiple conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-join-on-multiple-conditions/m-p/265210#M52127</link>
      <description>&lt;P&gt;What makes you believe the data condition was not applied? Provide some example input data that duplicates the behavior.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may be interested in attempting this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table temp1 as&lt;BR /&gt;select a.PatientID, a.AdministeredDate,&amp;nbsp;&lt;BR /&gt;b.TestDate, b.TestResult, (a.AdministeredDate -b.testdate) as dif_admin_test&lt;BR /&gt;from admindate as a&lt;BR /&gt;left join wgt as b&lt;BR /&gt;on a.patientid = b.patientid&lt;/P&gt;
&lt;P&gt;where a.AdministeredDate -b.testdate &amp;lt;= 7&lt;BR /&gt;order by patientid, AdministeredDate, TestDate;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 19:48:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-join-on-multiple-conditions/m-p/265210#M52127</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-04-20T19:48:19Z</dc:date>
    </item>
  </channel>
</rss>

