<?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 problem using where statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-problem-using-where-statement/m-p/65509#M14231</link>
    <description>Thanks a lot, seems to work now. Needed the brackets. &lt;BR /&gt;
&lt;BR /&gt;
S</description>
    <pubDate>Thu, 20 Aug 2009 04:44:26 GMT</pubDate>
    <dc:creator>Simo</dc:creator>
    <dc:date>2009-08-20T04:44:26Z</dc:date>
    <item>
      <title>Proc sql problem using where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-problem-using-where-statement/m-p/65507#M14229</link>
      <description>Hi, &lt;BR /&gt;
I need to match cases from 2 datasets in  a way that they match in region, ID, diagnose code and date.&lt;BR /&gt;
&lt;BR /&gt;
region, ID and diagnose are exact matches but date can be a match from 3 different date variables in database 2.&lt;BR /&gt;
&lt;BR /&gt;
Here's the syntax&lt;BR /&gt;
&lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
CREATE TABLE d1d2&lt;BR /&gt;
AS&lt;BR /&gt;
SELECT*&lt;BR /&gt;
FROM  d1,d2&lt;BR /&gt;
WHERE d1.region=d2.region2 and d1.ID=d2.ID2 and d1.diagnose=d2.diagnose and&lt;BR /&gt;
d1.date=d2.date1 OR&lt;BR /&gt;
d1.date=d2.date2 OR&lt;BR /&gt;
d1.date=d2.date3 OR&lt;BR /&gt;
;&lt;BR /&gt;
QUIT;&lt;BR /&gt;
&lt;BR /&gt;
Works fine until the OR so what how to get it to work? &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
S</description>
      <pubDate>Wed, 19 Aug 2009 14:03:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-problem-using-where-statement/m-p/65507#M14229</guid>
      <dc:creator>Simo</dc:creator>
      <dc:date>2009-08-19T14:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql problem using where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-problem-using-where-statement/m-p/65508#M14230</link>
      <description>At first glance, you have an extra 'OR'.  I would also throw in some parentheses to control presedence.&lt;BR /&gt;
&lt;BR /&gt;
WHERE d1.region=d2.region2 and d1.ID=d2.ID2 and d1.diagnose=d2.diagnose and&lt;BR /&gt;
(d1.date=d2.date1 OR&lt;BR /&gt;
d1.date=d2.date2 OR&lt;BR /&gt;
d1.date=d2.date3 )&lt;BR /&gt;
;</description>
      <pubDate>Wed, 19 Aug 2009 14:29:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-problem-using-where-statement/m-p/65508#M14230</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2009-08-19T14:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql problem using where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-problem-using-where-statement/m-p/65509#M14231</link>
      <description>Thanks a lot, seems to work now. Needed the brackets. &lt;BR /&gt;
&lt;BR /&gt;
S</description>
      <pubDate>Thu, 20 Aug 2009 04:44:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-problem-using-where-statement/m-p/65509#M14231</guid>
      <dc:creator>Simo</dc:creator>
      <dc:date>2009-08-20T04:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql problem using where statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-sql-problem-using-where-statement/m-p/65510#M14232</link>
      <description>the brackets were not enough ~~ you also needed to lose the last (trailing) OR.&lt;BR /&gt;
 &lt;BR /&gt;
technically speaking, OR is an INFIX operator &lt;BR /&gt;
It needs something after the OR as well as before it.&lt;BR /&gt;
 &lt;BR /&gt;
PeterC</description>
      <pubDate>Fri, 21 Aug 2009 12:29:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-sql-problem-using-where-statement/m-p/65510#M14232</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-08-21T12:29:16Z</dc:date>
    </item>
  </channel>
</rss>

