<?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 Using &amp;quot;NOT IN&amp;quot; with macro code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-quot-NOT-IN-quot-with-macro-code/m-p/10021#M648</link>
    <description>Hi all,&lt;BR /&gt;
I was wondering is it possible to use "Not IN" in a conditional statement using the macro facility.&lt;BR /&gt;
&lt;BR /&gt;
I have tried the code in a statement like this:&lt;BR /&gt;
%IF &amp;amp;Variable NOT IN(Apples Oranges) %THEN %DO;&lt;BR /&gt;
%IF (&amp;amp;Variable NOT IN Apples Oranges) % THEN %DO;&lt;BR /&gt;
%IF (&amp;amp;Variable NOT IN (Apples Oranges)) %THEN %DO;&lt;BR /&gt;
&lt;BR /&gt;
I have also tried quoting the variable and the list objects.  Additionally, I have tried using commas as delimiters.&lt;BR /&gt;
&lt;BR /&gt;
None of the above has run and all have given the error message in the log that "A character operand was found in the %EVAL function or %IF condition where a numeric operand is required."&lt;BR /&gt;
&lt;BR /&gt;
Any help with this would be great!  &lt;BR /&gt;
Thanks&lt;BR /&gt;
&lt;BR /&gt;
~Matt</description>
    <pubDate>Tue, 24 Mar 2009 13:50:20 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-03-24T13:50:20Z</dc:date>
    <item>
      <title>Using "NOT IN" with macro code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-quot-NOT-IN-quot-with-macro-code/m-p/10021#M648</link>
      <description>Hi all,&lt;BR /&gt;
I was wondering is it possible to use "Not IN" in a conditional statement using the macro facility.&lt;BR /&gt;
&lt;BR /&gt;
I have tried the code in a statement like this:&lt;BR /&gt;
%IF &amp;amp;Variable NOT IN(Apples Oranges) %THEN %DO;&lt;BR /&gt;
%IF (&amp;amp;Variable NOT IN Apples Oranges) % THEN %DO;&lt;BR /&gt;
%IF (&amp;amp;Variable NOT IN (Apples Oranges)) %THEN %DO;&lt;BR /&gt;
&lt;BR /&gt;
I have also tried quoting the variable and the list objects.  Additionally, I have tried using commas as delimiters.&lt;BR /&gt;
&lt;BR /&gt;
None of the above has run and all have given the error message in the log that "A character operand was found in the %EVAL function or %IF condition where a numeric operand is required."&lt;BR /&gt;
&lt;BR /&gt;
Any help with this would be great!  &lt;BR /&gt;
Thanks&lt;BR /&gt;
&lt;BR /&gt;
~Matt</description>
      <pubDate>Tue, 24 Mar 2009 13:50:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-quot-NOT-IN-quot-with-macro-code/m-p/10021#M648</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-03-24T13:50:20Z</dc:date>
    </item>
    <item>
      <title>Re: Using "NOT IN" with macro code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-quot-NOT-IN-quot-with-macro-code/m-p/10022#M649</link>
      <description>I would suggest using %SYSFUNC and the SAS INDEX function, given what you have shown for code.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 24 Mar 2009 13:59:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-quot-NOT-IN-quot-with-macro-code/m-p/10022#M649</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-03-24T13:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using "NOT IN" with macro code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-quot-NOT-IN-quot-with-macro-code/m-p/10023#M650</link>
      <description>Yes, but to do this you first must set the minoperator option (which tells the SAS Macro Facility to recognize "in" as an operator).  Then to use the "not" you need to put the original expression in parens and place the "not" outside.  See below.&lt;BR /&gt;
&lt;BR /&gt;
160  options minoperator;&lt;BR /&gt;
161&lt;BR /&gt;
162  %macro testit;&lt;BR /&gt;
163  %if fred in fred %then&lt;BR /&gt;
164     %put yes;&lt;BR /&gt;
165  %else %put no;&lt;BR /&gt;
166  %mend;&lt;BR /&gt;
167&lt;BR /&gt;
168  %macro testitagain;&lt;BR /&gt;
169  %if not(fred in joe chuck al) %then&lt;BR /&gt;
170     %put yes;&lt;BR /&gt;
171  %else %put no;&lt;BR /&gt;
172  %mend;&lt;BR /&gt;
173&lt;BR /&gt;
174  %testit;&lt;BR /&gt;
yes&lt;BR /&gt;
175&lt;BR /&gt;
176  %testitagain;&lt;BR /&gt;
yes</description>
      <pubDate>Wed, 25 Mar 2009 15:26:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-quot-NOT-IN-quot-with-macro-code/m-p/10023#M650</guid>
      <dc:creator>PatrickG</dc:creator>
      <dc:date>2009-03-25T15:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using "NOT IN" with macro code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-quot-NOT-IN-quot-with-macro-code/m-p/10024#M651</link>
      <description>The option MINOPERATOR is new with SAS 9.2.&lt;BR /&gt;
&lt;BR /&gt;
MINOPERATOR System Option&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a003092012.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a003092012.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 25 Mar 2009 15:51:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-quot-NOT-IN-quot-with-macro-code/m-p/10024#M651</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-03-25T15:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: Using "NOT IN" with macro code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-quot-NOT-IN-quot-with-macro-code/m-p/640995#M191004</link>
      <description>&lt;P&gt;&lt;FONT face="book antiqua,palatino" color="#FF6600"&gt;&lt;STRONG&gt;&lt;EM&gt;%IF (&amp;amp;Variable NOT IN (Apples Oranges)) %THEN %DO;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="book antiqua,palatino" color="#FF6600"&gt;&lt;STRONG&gt;&lt;EM&gt;can try this, for you to use not in in macro , you have to use the %eval; but you can create a call symputx that will store the values apple and oranges , eg. lets say the macro variable with the name apple,oranges is fruits, so the macro &amp;amp;fruits will resolve to apple and oranges. so i will have the following code&lt;/EM&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="book antiqua,palatino" color="#FF6600"&gt;&lt;STRONG&gt;&lt;EM&gt;also remember to put the options statement at the top of the macro;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;options minioperator mindelimiter=",";&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;like this&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;%if not %eval (%upcase(&amp;amp;fruits) in APPLES,ORANGES) %then %do;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Apr 2020 20:08:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-quot-NOT-IN-quot-with-macro-code/m-p/640995#M191004</guid>
      <dc:creator>himself</dc:creator>
      <dc:date>2020-04-18T20:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: Using "NOT IN" with macro code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-quot-NOT-IN-quot-with-macro-code/m-p/641040#M191020</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt; I was wondering is it possible to use "Not IN" in a conditional statement using the macro facility.&lt;/EM&gt;&lt;BR /&gt;Yes it is. Look at the &lt;FONT face="courier new,courier"&gt;minoperator&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;mindelimiter&lt;/FONT&gt; options.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Apr 2020 03:59:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-quot-NOT-IN-quot-with-macro-code/m-p/641040#M191020</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-04-19T03:59:10Z</dc:date>
    </item>
  </channel>
</rss>

