<?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: Do we have a &amp;quot;where NOT in&amp;quot; statement? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Do-we-have-a-quot-where-NOT-in-quot-statement/m-p/57980#M16187</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have recently seen "NOTIN", which seems to work: however, there is no space between the infix and the operator.&amp;nbsp; Is this even possible?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Jul 2015 15:53:48 GMT</pubDate>
    <dc:creator>bhthomas99</dc:creator>
    <dc:date>2015-07-10T15:53:48Z</dc:date>
    <item>
      <title>Do we have a "where NOT in" statement?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-we-have-a-quot-where-NOT-in-quot-statement/m-p/57975#M16182</link>
      <description>I know this is a very simple question, &lt;BR /&gt;
We have a " where in (1,2,3,....)" statement &lt;BR /&gt;
do we have "where not in (1,2,3...)?" or a similar statement?&lt;BR /&gt;
&lt;BR /&gt;
Thanks!</description>
      <pubDate>Thu, 23 Jul 2009 18:31:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-we-have-a-quot-where-NOT-in-quot-statement/m-p/57975#M16182</guid>
      <dc:creator>Ken_oy</dc:creator>
      <dc:date>2009-07-23T18:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: Do we have a "where NOT in" statement?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-we-have-a-quot-where-NOT-in-quot-statement/m-p/57976#M16183</link>
      <description>&lt;P&gt;yes - just use it as you've written it (almost).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where varname not in (1,2,3);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt; Dare to experiment - error messages are free!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Editor's note: consolidating some other helpful comments in this solution...&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/51361"&gt;@bhthomas99﻿&lt;/a&gt;&lt;/EM&gt; asks about the NOTIN operator (no space). &amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/48282"&gt;@abbess﻿&lt;/a&gt;&amp;nbsp;replied:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;The &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;NOTIN&lt;/STRONG&gt;&lt;/FONT&gt; operator work perfectly, I have tried it my self. Also it is mentioned in the SAS Support that &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;NOT&lt;/FONT&gt; &lt;/STRONG&gt;is a prefix wich can be used with other operators.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;"&lt;EM&gt;A &lt;/EM&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN class="strong"&gt;prefix operator&lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN&gt;&lt;EM&gt; is an operator that is applied to the variable, constant, function, or parenthetic expression that immediately follows it. The plus sign (+) and minus sign (-) can be used as prefix operators. The word NOT and its equivalent symbols are also prefix operators&lt;/EM&gt;"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;See &lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/68089/HTML/default/viewer.htm#p00iah2thp63bmn1lt20esag14lh.htm" target="_self"&gt;SAS Operators in Expressions&lt;/A&gt;&amp;nbsp;(SAS documentation)&lt;/SPAN&gt;&lt;/P&gt;
&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;And&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13604"&gt;@Doc_Duke﻿&lt;/a&gt;&amp;nbsp;points out that order-of-operations matters:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;SPAN&gt;Be careful combining NOT, AND, and OR; you don't always get what you think, especially if you leave it to SAS to resolve the expression. For instance,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;not varname IN (1, 2, 3)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;does not give the same answer as&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;not (varname in (1,2,3)&lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2016 14:14:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-we-have-a-quot-where-NOT-in-quot-statement/m-p/57976#M16183</guid>
      <dc:creator>Bill</dc:creator>
      <dc:date>2016-07-29T14:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: Do we have a "where NOT in" statement?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-we-have-a-quot-where-NOT-in-quot-statement/m-p/57977#M16184</link>
      <description>Bill wrote:&lt;BR /&gt;
&amp;gt;Dare to experiment - error messages are free! &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks for the chuckle - my log is full of Red today.</description>
      <pubDate>Thu, 23 Jul 2009 19:19:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-we-have-a-quot-where-NOT-in-quot-statement/m-p/57977#M16184</guid>
      <dc:creator>stateworker</dc:creator>
      <dc:date>2009-07-23T19:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: Do we have a "where NOT in" statement?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-we-have-a-quot-where-NOT-in-quot-statement/m-p/57978#M16185</link>
      <description>More completely, you can put a "not" infix operator in nearly every logical expression, and often outside, e.g. &lt;BR /&gt;
where not (varname IN (1,2,3)); &lt;BR /&gt;
is a valid statement.  &lt;BR /&gt;
&lt;BR /&gt;
Be careful combining NOT, AND, and OR; you don't always get what you think, especially if you leave it to SAS to resolve the expression.  For instance,&lt;BR /&gt;
&lt;BR /&gt;
not varname IN (1, 2, 3)&lt;BR /&gt;
&lt;BR /&gt;
does not give the same answer as&lt;BR /&gt;
&lt;BR /&gt;
not (varname in (1,2,3)</description>
      <pubDate>Thu, 23 Jul 2009 20:19:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-we-have-a-quot-where-NOT-in-quot-statement/m-p/57978#M16185</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2009-07-23T20:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Do we have a "where NOT in" statement?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-we-have-a-quot-where-NOT-in-quot-statement/m-p/57979#M16186</link>
      <description>Thanks for this Doc. I always use NOT before IN, and it never occured to me that&lt;BR /&gt;
&lt;BR /&gt;
not varname IN (1, 2, 3)&lt;BR /&gt;
&lt;BR /&gt;
reads as&lt;BR /&gt;
&lt;BR /&gt;
(not varname) IN (1, 2, 3) which is true is var = 0&lt;BR /&gt;
&lt;BR /&gt;
I'll keep this is mind, and add this comment so more people have a chance to read the thread.</description>
      <pubDate>Sun, 26 Jul 2009 21:47:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-we-have-a-quot-where-NOT-in-quot-statement/m-p/57979#M16186</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-07-26T21:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: Do we have a "where NOT in" statement?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-we-have-a-quot-where-NOT-in-quot-statement/m-p/57980#M16187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have recently seen "NOTIN", which seems to work: however, there is no space between the infix and the operator.&amp;nbsp; Is this even possible?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jul 2015 15:53:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-we-have-a-quot-where-NOT-in-quot-statement/m-p/57980#M16187</guid>
      <dc:creator>bhthomas99</dc:creator>
      <dc:date>2015-07-10T15:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: Do we have a "where NOT in" statement?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-we-have-a-quot-where-NOT-in-quot-statement/m-p/248689#M56462</link>
      <description>&lt;P&gt;The &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;NOTIN&lt;/STRONG&gt;&lt;/FONT&gt; operator work perfectly, I have tried it my self. Also it is mentionned in the SAS Support that &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;NOT&lt;/FONT&gt; &lt;/STRONG&gt;is a prefix wich can be used with other operators.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"&lt;EM&gt;A &lt;/EM&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN class="strong"&gt;prefix operator&lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN&gt;&lt;EM&gt; is an operator that is applied to the variable, constant, function, or parenthetic expression that immediately follows it. The plus sign (+) and minus sign (-) can be used as prefix operators. The word NOT and its equivalent symbols are also prefix operators&lt;/EM&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Source:&amp;nbsp;&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000780367.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000780367.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2016 16:03:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-we-have-a-quot-where-NOT-in-quot-statement/m-p/248689#M56462</guid>
      <dc:creator>abbess</dc:creator>
      <dc:date>2016-02-08T16:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: Do we have a "where NOT in" statement?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Do-we-have-a-quot-where-NOT-in-quot-statement/m-p/288265#M59577</link>
      <description>&lt;P&gt;Although you have a couple of already accepted solutions, I wanted to throw my two cents in as a PROC SQL guy. &amp;nbsp;I use the NOTIN frequently, especially when querying text:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All my data:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;


select product, count(*)
from sashelp.shoes
group by product
order by product
;

quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/4338iD4AD576B74FDC6F7/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="Screen Shot 2016-07-29 at 7.46.55 PM.png" title="Screen Shot 2016-07-29 at 7.46.55 PM.png" width="176" height="266" /&gt;&lt;/P&gt;
&lt;P&gt;Excluding BOOT and SANDAL:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;


select product, count(*)
from sashelp.shoes

where product notin ('Boot','Sandal')

group by product
order by product
;

quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/4339i351D388497117320/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="Screen Shot 2016-07-29 at 7.47.19 PM.png" title="Screen Shot 2016-07-29 at 7.47.19 PM.png" width="148" height="171" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck!&lt;/P&gt;
&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2016 23:50:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Do-we-have-a-quot-where-NOT-in-quot-statement/m-p/288265#M59577</guid>
      <dc:creator>DarthPathos</dc:creator>
      <dc:date>2016-07-29T23:50:00Z</dc:date>
    </item>
  </channel>
</rss>

