<?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 : How to exclude records based on the values of a column in another table? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-How-to-exclude-records-based-on-the-values-of-a-column/m-p/371929#M88872</link>
    <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;select * from HAVE1 &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;except &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;select unique Member_ID from HAVE2 where Spending_code='A1';&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Jun 2017 23:20:00 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2017-06-29T23:20:00Z</dc:date>
    <item>
      <title>PROC SQL : How to exclude records based on the values of a column in another table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-How-to-exclude-records-based-on-the-values-of-a-column/m-p/371925#M88868</link>
      <description>&lt;P&gt;I have a table that contains &amp;nbsp;member id and then I wanted to join to another table using member id and look for the member spending code. A member can have multiple spending code, so what I want to achieve is to remove the member from the fianl result if the member has a spending code 'A1'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using PROC SQL , how can the below results be achieved?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Member table:&lt;/P&gt;
&lt;P&gt;Member_ID&lt;/P&gt;
&lt;P&gt;101&lt;/P&gt;
&lt;P&gt;102&lt;/P&gt;
&lt;P&gt;103&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Spending table&lt;/P&gt;
&lt;P&gt;Member_ID Spending_code&lt;/P&gt;
&lt;P&gt;101 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;B1&lt;/P&gt;
&lt;P&gt;101 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CC&lt;/P&gt;
&lt;P&gt;101 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A1&lt;/P&gt;
&lt;P&gt;102 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CC&lt;/P&gt;
&lt;P&gt;102 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DD&lt;/P&gt;
&lt;P&gt;103 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DD&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My desired result is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Member_id&lt;/P&gt;
&lt;P&gt;102&lt;/P&gt;
&lt;P&gt;103&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please help?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 22:50:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-How-to-exclude-records-based-on-the-values-of-a-column/m-p/371925#M88868</guid>
      <dc:creator>renjithr</dc:creator>
      <dc:date>2017-06-29T22:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL : How to exclude records based on the values of a column in another table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-How-to-exclude-records-based-on-the-values-of-a-column/m-p/371926#M88869</link>
      <description>&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;select * from member_table&lt;/P&gt;
&lt;P&gt;where member_id not in(select&amp;nbsp;&lt;SPAN&gt;Member_ID from spending_table where member_id is not null);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;quit&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 22:54:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-How-to-exclude-records-based-on-the-values-of-a-column/m-p/371926#M88869</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-06-29T22:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL : How to exclude records based on the values of a column in another table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-How-to-exclude-records-based-on-the-values-of-a-column/m-p/371927#M88870</link>
      <description>&lt;P&gt;Thanks Kiranv!&lt;/P&gt;
&lt;P&gt;But you query is only returning 103. I need both 102 and 103.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 23:00:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-How-to-exclude-records-based-on-the-values-of-a-column/m-p/371927#M88870</guid>
      <dc:creator>renjithr</dc:creator>
      <dc:date>2017-06-29T23:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL : How to exclude records based on the values of a column in another table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-How-to-exclude-records-based-on-the-values-of-a-column/m-p/371929#M88872</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;select * from HAVE1 &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;except &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;select unique Member_ID from HAVE2 where Spending_code='A1';&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 23:20:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-How-to-exclude-records-based-on-the-values-of-a-column/m-p/371929#M88872</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-06-29T23:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL : How to exclude records based on the values of a column in another table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-How-to-exclude-records-based-on-the-values-of-a-column/m-p/371931#M88873</link>
      <description>&lt;P&gt;Hi ChrisNZ,&lt;/P&gt;
&lt;P&gt;Sorry, I am afraid it is not the solution.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 23:23:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-How-to-exclude-records-based-on-the-values-of-a-column/m-p/371931#M88873</guid>
      <dc:creator>renjithr</dc:creator>
      <dc:date>2017-06-29T23:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL : How to exclude records based on the values of a column in another table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-How-to-exclude-records-based-on-the-values-of-a-column/m-p/371932#M88874</link>
      <description>&lt;P&gt;may be something like this&lt;/P&gt;
&lt;P&gt;proc sql; &lt;BR /&gt;select member_id from membertable where member_id in &lt;BR /&gt;(select member_id from spendingtable where member_id not in&lt;BR /&gt;(select Member_ID from spendingtable &amp;nbsp;where spending_code ='A1'));&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 23:27:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-How-to-exclude-records-based-on-the-values-of-a-column/m-p/371932#M88874</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-06-29T23:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL : How to exclude records based on the values of a column in another table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-How-to-exclude-records-based-on-the-values-of-a-column/m-p/371933#M88875</link>
      <description>&lt;P&gt;Will every member have data in both tables?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc sql;
Create table want as
Select distinct Id 
From table1
Where id not in (select distinct Id from spendingTable where code eq 'A1');
Quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Jun 2017 23:41:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-How-to-exclude-records-based-on-the-values-of-a-column/m-p/371933#M88875</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-29T23:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL : How to exclude records based on the values of a column in another table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-How-to-exclude-records-based-on-the-values-of-a-column/m-p/371937#M88877</link>
      <description>&lt;P&gt;Why not? The output is&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure SQL: Query Results" frame="box" rules="all" cellpadding="5" cellspacing="0"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r b header" scope="col"&gt;Member_ID&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;102&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;103&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 30 Jun 2017 00:09:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-How-to-exclude-records-based-on-the-values-of-a-column/m-p/371937#M88877</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-06-30T00:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL : How to exclude records based on the values of a column in another table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-How-to-exclude-records-based-on-the-values-of-a-column/m-p/372219#M88956</link>
      <description>&lt;P&gt;Apologies!&lt;/P&gt;
&lt;P&gt;Your solution works, Thank you so much !&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 15:31:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-How-to-exclude-records-based-on-the-values-of-a-column/m-p/372219#M88956</guid>
      <dc:creator>renjithr</dc:creator>
      <dc:date>2017-06-30T15:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL : How to exclude records based on the values of a column in another table?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-How-to-exclude-records-based-on-the-values-of-a-column/m-p/372220#M88957</link>
      <description>&lt;P&gt;Thanks Reeza!&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 15:31:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-How-to-exclude-records-based-on-the-values-of-a-column/m-p/372220#M88957</guid>
      <dc:creator>renjithr</dc:creator>
      <dc:date>2017-06-30T15:31:17Z</dc:date>
    </item>
  </channel>
</rss>

