<?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: Subquery evaluated to more than one row in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Subquery-evaluated-to-more-than-one-row/m-p/476437#M122615</link>
    <description>&lt;P&gt;Just use syntax that allows for multiple results of the sub-select:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select *
from table_all 
where id not in (select id from table_Y) and id not in (select id from table_P);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 09 Jul 2018 13:15:47 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-07-09T13:15:47Z</dc:date>
    <item>
      <title>Subquery evaluated to more than one row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Subquery-evaluated-to-more-than-one-row/m-p/476425#M122611</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to select some records from my master table (e.g. table_all) having all records excluding all records available in table_Y and table_P. I am getting the error message:&amp;nbsp; Subquery evaluated to more than one row.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data table_all;
input id status $  ;
datalines;
101 F
102 C
103 F
104 F
104 C
105 F
106 F
106 C
108 F
109 C
;
run;


data table_Y;
input id Consult $ ;
datalines;
101 Y
104 Y
;
run;


data table_P;
input id type $;
datalines;
104 P
106 P
109 P
;
run;


data table_F_Not_Y_Not_P;
input id status $ ;
datalines;
103 F
105 F
108 F
;
run;


proc sql;
create table want as
select *
from table_all 
where id ne (select id from table_Y) and id ne (select id from table_P);
quit;

/*WANT=table_F_Not_Y_Not_P*/&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks in advance for your kind reply to overcome the error message.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 13:07:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Subquery-evaluated-to-more-than-one-row/m-p/476425#M122611</guid>
      <dc:creator>DeepakSwain</dc:creator>
      <dc:date>2018-07-09T13:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Subquery evaluated to more than one row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Subquery-evaluated-to-more-than-one-row/m-p/476437#M122615</link>
      <description>&lt;P&gt;Just use syntax that allows for multiple results of the sub-select:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select *
from table_all 
where id not in (select id from table_Y) and id not in (select id from table_P);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Jul 2018 13:15:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Subquery-evaluated-to-more-than-one-row/m-p/476437#M122615</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-07-09T13:15:47Z</dc:date>
    </item>
  </channel>
</rss>

