<?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: Code should result in error but it does not in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Code-should-result-in-error-but-it-does-not/m-p/932792#M366936</link>
    <description>&lt;P&gt;Thank you all for your help. I will be trying these ideas to ensure I understand what is happening and try to learn new habits so I don't inadvertently end up with unexpected results and think they are ok - all because I didn't get an error.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Jun 2024 13:16:22 GMT</pubDate>
    <dc:creator>MParthasarathy</dc:creator>
    <dc:date>2024-06-18T13:16:22Z</dc:date>
    <item>
      <title>Code should result in error but it does not</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-should-result-in-error-but-it-does-not/m-p/932462#M366817</link>
      <description>&lt;P&gt;Hello SAS Users - Here is an example that is baffling me and my team mate.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test;&lt;BR /&gt;input name1 $ name2 $;&lt;BR /&gt;datalines;&lt;BR /&gt;AA BB&lt;BR /&gt;CC DD&lt;BR /&gt;EE FF&lt;BR /&gt;HH PP&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data name;&lt;BR /&gt;input &lt;STRONG&gt;code&lt;/STRONG&gt; $;&lt;BR /&gt;datalines;&lt;BR /&gt;AA&lt;BR /&gt;FF&lt;BR /&gt;HH&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table result as&lt;BR /&gt;select *&amp;nbsp;&amp;nbsp;from test&lt;BR /&gt;where name1 in (select &lt;STRONG&gt;name1&lt;/STRONG&gt; from name) ;&amp;nbsp; &lt;FONT color="#339966"&gt;/*name1 doesn't exist in the "name" dataset */&lt;/FONT&gt;&lt;BR /&gt;quit ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;NOTE: Table WORK.RESULT created, with 4 rows and 2 columns.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The last proc sql step should result in an error because there is no field called "name1" in dataset name but it does not give us an error.&amp;nbsp; Instead it does the search, and gives us the entire "test" dataset.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But if I change the last proc sql to read like below:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table result as&lt;BR /&gt;select * from test&lt;BR /&gt;where name1 in (select &lt;STRONG&gt;x&lt;/STRONG&gt; from name);&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800000"&gt;ERROR: The following columns were not found in the contributing tables: x.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Shouldn't I get an error response in both cases? Or maybe there is something I don't understand about SAS in this.&amp;nbsp; Thank you for any insight you can provide.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2024 18:53:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-should-result-in-error-but-it-does-not/m-p/932462#M366817</guid>
      <dc:creator>MParthasarathy</dc:creator>
      <dc:date>2024-06-14T18:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: Code should result in error but it does not</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-should-result-in-error-but-it-does-not/m-p/932517#M366838</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/259891"&gt;@MParthasarathy&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This was discussed in the 2021 thread &lt;A href="https://communities.sas.com/t5/SAS-Programming/Proc-sql-giving-result-when-expected-not-to/m-p/723643/highlight/true#M224584" target="_blank" rel="noopener"&gt;Proc sql giving result when expected not to&lt;/A&gt;. Please see the solution there. Does it answer your question?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2024 21:28:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-should-result-in-error-but-it-does-not/m-p/932517#M366838</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-06-14T21:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: Code should result in error but it does not</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-should-result-in-error-but-it-does-not/m-p/932520#M366841</link>
      <description>&lt;UL class="lia-list-style-type-square"&gt;
&lt;LI&gt;
&lt;P&gt;Case when used with a subquery strange result..&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/Case-when-used-with-a-subquery-strange-result/td-p/210931" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/Case-when-used-with-a-subquery-strange-result/td-p/210931&lt;/A&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;SQL subquery, wrong variable name, no error&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/SQL-subquery-wrong-variable-name-no-error/td-p/606354" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/SQL-subquery-wrong-variable-name-no-error/td-p/606354&lt;/A&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;Koen&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2024 21:32:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-should-result-in-error-but-it-does-not/m-p/932520#M366841</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2024-06-14T21:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: Code should result in error but it does not</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-should-result-in-error-but-it-does-not/m-p/932524#M366844</link>
      <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/SQL-subquery-wrong-variable-name-no-error/m-p/606402/highlight/true#M76573" target="_blank" rel="noopener"&gt;Hint&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2024 07:04:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-should-result-in-error-but-it-does-not/m-p/932524#M366844</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-06-15T07:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: Code should result in error but it does not</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-should-result-in-error-but-it-does-not/m-p/932539#M366852</link>
      <description>&lt;P&gt;But there is a variable NAME1, so SAS assumed that is the variable you wanted.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;324  proc sql feedback;
325  create table result as
326  select *  from test
327  where name1 in (select name1 from name) ;
NOTE: Statement transforms to:

        select TEST.name1, TEST.name2
          from WORK.TEST
         where TEST.name1 in
               ( select TEST.name1
                   from WORK.NAME
               );

NOTE: Table WORK.RESULT created, with 4 rows and 2 columns.

328  quit ;
&lt;/PRE&gt;
&lt;P&gt;If you meant some other variable named NAME1 then say so.&lt;/P&gt;
&lt;PRE&gt;329  proc sql feedback;
330  create table result as
331  select *  from test
332  where test.name1 in (select name.name1 from name) ;
ERROR: Column name1 could not be found in the table/view identified with the correlation
       name NAME.
ERROR: Unresolved reference to table/correlation name name.
NOTE: Statement transforms to:

        select TEST.name1, TEST.name2
          from WORK.TEST
         where TEST.name1 in
               ( select name.name1
                   from WORK.NAME
               );

333  quit ;
&lt;/PRE&gt;</description>
      <pubDate>Sat, 15 Jun 2024 16:05:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-should-result-in-error-but-it-does-not/m-p/932539#M366852</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-06-15T16:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: Code should result in error but it does not</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-should-result-in-error-but-it-does-not/m-p/932792#M366936</link>
      <description>&lt;P&gt;Thank you all for your help. I will be trying these ideas to ensure I understand what is happening and try to learn new habits so I don't inadvertently end up with unexpected results and think they are ok - all because I didn't get an error.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 13:16:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-should-result-in-error-but-it-does-not/m-p/932792#M366936</guid>
      <dc:creator>MParthasarathy</dc:creator>
      <dc:date>2024-06-18T13:16:22Z</dc:date>
    </item>
  </channel>
</rss>

