<?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: SAS bug in select subquery? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-bug-in-select-subquery/m-p/815421#M321862</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/271494"&gt;@jffeudo86&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Is there a know bug and what's the fix?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;create tableC as&lt;/P&gt;
&lt;P&gt;select *&lt;/P&gt;
&lt;P&gt;from tableA&lt;/P&gt;
&lt;P&gt;where accountid in (select accountid from tableB);&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if accountid is not a column in tableB it seems SAS takes the value of accountid from tableA.&amp;nbsp; Anyone has encountered this, and what's the fix?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Programmer error.&amp;nbsp; Be specific about what variables you want to select.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where tablea.accountid in (select tableb.accountid from tableB)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To see why it is not a bug consider that there are situations where you do want to use a variable from a different dataset in the sub-query.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 27 May 2022 14:54:17 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-05-27T14:54:17Z</dc:date>
    <item>
      <title>SAS bug in select subquery?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-bug-in-select-subquery/m-p/815416#M321859</link>
      <description>&lt;P&gt;Is there a know bug and what's the fix?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create tableC as&lt;/P&gt;&lt;P&gt;select *&lt;/P&gt;&lt;P&gt;from tableA&lt;/P&gt;&lt;P&gt;where accountid in (select accountid from tableB);&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if accountid is not a column in tableB it seems SAS takes the value of accountid from tableA.&amp;nbsp; Anyone has encountered this, and what's the fix?&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 14:03:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-bug-in-select-subquery/m-p/815416#M321859</guid>
      <dc:creator>jffeudo86</dc:creator>
      <dc:date>2022-05-27T14:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: SAS bug in select subquery?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-bug-in-select-subquery/m-p/815419#M321861</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/271494"&gt;@jffeudo86&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Last year there was a discussion about this in &lt;A href="https://communities.sas.com/t5/SAS-Programming/Proc-sql-giving-result-when-expected-not-to/m-p/723508" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Programming/Proc-sql-giving-result-when-expected-not-to/m-p/723508&lt;/A&gt;. And that was not the first time someone stumbled across it (see &lt;A href="https://communities.sas.com/t5/SAS-Programming/Proc-sql-giving-result-when-expected-not-to/m-p/723838/highlight/true#M224692" target="_blank" rel="noopener"&gt;the most recent post in that thread&lt;/A&gt;).&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 14:27:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-bug-in-select-subquery/m-p/815419#M321861</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-05-27T14:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: SAS bug in select subquery?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-bug-in-select-subquery/m-p/815421#M321862</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/271494"&gt;@jffeudo86&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Is there a know bug and what's the fix?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;create tableC as&lt;/P&gt;
&lt;P&gt;select *&lt;/P&gt;
&lt;P&gt;from tableA&lt;/P&gt;
&lt;P&gt;where accountid in (select accountid from tableB);&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if accountid is not a column in tableB it seems SAS takes the value of accountid from tableA.&amp;nbsp; Anyone has encountered this, and what's the fix?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Programmer error.&amp;nbsp; Be specific about what variables you want to select.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where tablea.accountid in (select tableb.accountid from tableB)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To see why it is not a bug consider that there are situations where you do want to use a variable from a different dataset in the sub-query.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 14:54:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-bug-in-select-subquery/m-p/815421#M321862</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-05-27T14:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: SAS bug in select subquery?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-bug-in-select-subquery/m-p/815422#M321863</link>
      <description>&lt;P&gt;An addendum to elegant responses,&amp;nbsp; to discern is actually the situation analogous to the function of OR(logic gates) and the corresponding TRUTH tables. Alas, should that be too much to dig in, a better way to understand this -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;if x=1 or 2; /*this is what's happening and will always be true*/&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;such that if and only if X is captured by the SQL optimizer access path&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 15:04:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-bug-in-select-subquery/m-p/815422#M321863</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2022-05-27T15:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: SAS bug in select subquery?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-bug-in-select-subquery/m-p/815430#M321865</link>
      <description>&lt;P&gt;Thank you!&amp;nbsp; That makes sense although using a variable from outside the subquery is basically returning the number of rows of the subquery.&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 15:59:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-bug-in-select-subquery/m-p/815430#M321865</guid>
      <dc:creator>jffeudo86</dc:creator>
      <dc:date>2022-05-27T15:59:14Z</dc:date>
    </item>
  </channel>
</rss>

