<?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: Where not in deleting all in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Where-not-in-deleting-all/m-p/478846#M31072</link>
    <description>&lt;P&gt;Show us an example of your data, and an example of what you want to see in the results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since we're trying to help you, could you please help us out as well? Please type in actual sentences, with a period at the end, and a capitalized letter to start the next sentence, and you know, follow ALL the rules of proper writing. Thanks.&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jul 2018 21:33:02 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2018-07-17T21:33:02Z</dc:date>
    <item>
      <title>Where not in deleting all</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Where-not-in-deleting-all/m-p/478744#M31055</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql; 
create table want as 
select *  
from have
where MEM_ID not in (select MEM_ID from have1);
run; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;i have MEM_ID and item_id in both tables the sas code deletes all MEM_ID however i want to match both MEM_ID and item_id not just MEM_ID as the code i have is delecting data i dont want to delete&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 17:48:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Where-not-in-deleting-all/m-p/478744#M31055</guid>
      <dc:creator>hk2013</dc:creator>
      <dc:date>2018-07-17T17:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: Where not in deleting all</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Where-not-in-deleting-all/m-p/478788#M31066</link>
      <description>&lt;P&gt;It is a little confusing what you are&amp;nbsp;trying to do. Are you trying to delete all the observation where MEM_id is not equal to&amp;nbsp;&lt;SPAN&gt;item_id?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 19:23:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Where-not-in-deleting-all/m-p/478788#M31066</guid>
      <dc:creator>Tommy1</dc:creator>
      <dc:date>2018-07-17T19:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: Where not in deleting all</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Where-not-in-deleting-all/m-p/478819#M31069</link>
      <description>&lt;P&gt;If you are getting an empty result set then that means that all of the MEM_ID values in HAVE are also in HAVE1.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically HAVE is a subset of HAVE1, at least in terms of MEM_ID values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you meant to do the test in the other way?&amp;nbsp; To find the records that are in HAVE1 but not in HAVE?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps your MEM_ID values are all missing? Or&amp;nbsp;some other constant ? Or truncated so that they match artificially?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 20:38:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Where-not-in-deleting-all/m-p/478819#M31069</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-07-17T20:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: Where not in deleting all</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Where-not-in-deleting-all/m-p/478840#M31071</link>
      <description>&lt;P&gt;Have1 is the data i dont want in my 'Have' data set but deleting by just MEM_ID it is deleting&amp;nbsp; MEM_ID data thats not in Have1&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example MEM_ID 1 and item_id A are in HAVE1 and also in HAVE so i want to delete it however MEM_ID 1 has item_id B and C which&amp;nbsp; i want to keep but because of my code they are being deleted based on mem_ID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 21:24:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Where-not-in-deleting-all/m-p/478840#M31071</guid>
      <dc:creator>hk2013</dc:creator>
      <dc:date>2018-07-17T21:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: Where not in deleting all</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Where-not-in-deleting-all/m-p/478846#M31072</link>
      <description>&lt;P&gt;Show us an example of your data, and an example of what you want to see in the results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since we're trying to help you, could you please help us out as well? Please type in actual sentences, with a period at the end, and a capitalized letter to start the next sentence, and you know, follow ALL the rules of proper writing. Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 21:33:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Where-not-in-deleting-all/m-p/478846#M31072</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-07-17T21:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: Where not in deleting all</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Where-not-in-deleting-all/m-p/479061#M31086</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql; 
create table want as 
select *  
from have
where catx(' ',MEM_ID,item_id) not in (select catx(' ',MEM_ID,item_id) from have1);
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Jul 2018 14:02:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Where-not-in-deleting-all/m-p/479061#M31086</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-07-18T14:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: Where not in deleting all</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Where-not-in-deleting-all/m-p/479063#M31087</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql; 
create table want as 
select *  
from have
where catx(' ',MEM_ID,item_id) not in (select catx(' ',MEM_ID,item_id) from have1);
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Jul 2018 14:06:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Where-not-in-deleting-all/m-p/479063#M31087</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-07-18T14:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: Where not in deleting all</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Where-not-in-deleting-all/m-p/479071#M31088</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/169082"&gt;@hk2013&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Have1 is the data i dont want in my 'Have' data set but deleting by just MEM_ID it is deleting&amp;nbsp; MEM_ID data thats not in Have1&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;example MEM_ID 1 and item_id A are in HAVE1 and also in HAVE so i want to delete it however MEM_ID 1 has item_id B and C which&amp;nbsp; i want to keep but because of my code they are being deleted based on mem_ID&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That is a totally different question.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would probably find it much easier to use normal SAS instead of trying to get SQL to do what you want.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  merge have1 (in=in1) have2(in=in2 keep=mem_id item_id);
  by mem_id item_id ;
  if in1 and not in2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In SQL it might be more appropriate to use EXIST&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;
create table want as 
select * from have1 
where not exist
  (select 1 
    from have2
    where have1.mem_id=have2.mem_id 
      and have1.item_id = have2.item_id
  )
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Jul 2018 14:15:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Where-not-in-deleting-all/m-p/479071#M31088</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-07-18T14:15:52Z</dc:date>
    </item>
  </channel>
</rss>

