<?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 %EVAL error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/EVAL-error/m-p/752047#M236835</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using below code to identiy the yyyymm in old vs new path. I am getting %EVAL error, could someone help me with it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;

%macro comp(yyyymm);
%let new_path = /sas/Prod/Data/July21/&amp;amp;yyyymm.;
%if %eval(&amp;amp;yyyymm. IN 
	200701 200704
	200810
	200905 200906 200911 200912
	201005 201006 201011 201012
	201205 201206 201209 
	201408 201409 201410 201411 201412)|(&amp;amp;yyyymm. &amp;gt;= 201704 &amp;amp; &amp;amp;yyyymm. &amp;lt;= 202008) %then %do;
	%let old_path = /sas/Prod/&amp;amp;yyyymm.;
	%end;
%else %if &amp;amp;yyyymm. = 200808 | &amp;amp;yyyymm. = 200809 | (&amp;amp;yyyymm. &amp;gt;= 201301 &amp;amp; &amp;amp;yyyymm. &amp;lt;= 201612) |  (&amp;amp;yyyymm. &amp;gt;= 201701 &amp;amp; &amp;amp;yyyymm. &amp;lt;= 201703) %then %do;
	%let old_path = /sas/Prod/BT/&amp;amp;yyyymm.;
	%end;
%else %do;
	%let old_path = /sas/Prod/Repair/&amp;amp;yyyymm.;
	%end;


LIBNAME N&amp;amp;yyyymm. "&amp;amp;new_path." access=readonly;
LIBNAME O&amp;amp;yyyymm. "&amp;amp;old_path.";
%mend;

%comp(200701); 
 
&lt;/PRE&gt;
&lt;P&gt;error :&lt;/P&gt;
&lt;P&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was:&lt;/P&gt;
&lt;P&gt;200701 IN 200701 200704 200810 200905 200906 200911 200912 201005 201006 201011 201012 201205 201206 201209 201408&lt;/P&gt;
&lt;P&gt;201409 201410 201411 201412&lt;/P&gt;
&lt;P&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was:&lt;/P&gt;
&lt;P&gt;%eval(&amp;amp;yyyymm. IN 200701 200704 200810 200905 200906 200911 200912 201005 201006 201011 201012 201205 201206 201209&lt;/P&gt;
&lt;P&gt;201408 201409 201410 201411 201412)|(&amp;amp;yyyymm. &amp;gt;= 201704 &amp;amp; &amp;amp;yyyymm. &amp;lt;= 202008)&lt;/P&gt;
&lt;P&gt;2 The SAS System 11:15 Monday, July 5, 2021&lt;/P&gt;
&lt;P&gt;ERROR: The macro COMP will stop executing.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Jul 2021 10:24:24 GMT</pubDate>
    <dc:creator>vnreddy</dc:creator>
    <dc:date>2021-07-05T10:24:24Z</dc:date>
    <item>
      <title>%EVAL error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/EVAL-error/m-p/752047#M236835</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using below code to identiy the yyyymm in old vs new path. I am getting %EVAL error, could someone help me with it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;

%macro comp(yyyymm);
%let new_path = /sas/Prod/Data/July21/&amp;amp;yyyymm.;
%if %eval(&amp;amp;yyyymm. IN 
	200701 200704
	200810
	200905 200906 200911 200912
	201005 201006 201011 201012
	201205 201206 201209 
	201408 201409 201410 201411 201412)|(&amp;amp;yyyymm. &amp;gt;= 201704 &amp;amp; &amp;amp;yyyymm. &amp;lt;= 202008) %then %do;
	%let old_path = /sas/Prod/&amp;amp;yyyymm.;
	%end;
%else %if &amp;amp;yyyymm. = 200808 | &amp;amp;yyyymm. = 200809 | (&amp;amp;yyyymm. &amp;gt;= 201301 &amp;amp; &amp;amp;yyyymm. &amp;lt;= 201612) |  (&amp;amp;yyyymm. &amp;gt;= 201701 &amp;amp; &amp;amp;yyyymm. &amp;lt;= 201703) %then %do;
	%let old_path = /sas/Prod/BT/&amp;amp;yyyymm.;
	%end;
%else %do;
	%let old_path = /sas/Prod/Repair/&amp;amp;yyyymm.;
	%end;


LIBNAME N&amp;amp;yyyymm. "&amp;amp;new_path." access=readonly;
LIBNAME O&amp;amp;yyyymm. "&amp;amp;old_path.";
%mend;

%comp(200701); 
 
&lt;/PRE&gt;
&lt;P&gt;error :&lt;/P&gt;
&lt;P&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was:&lt;/P&gt;
&lt;P&gt;200701 IN 200701 200704 200810 200905 200906 200911 200912 201005 201006 201011 201012 201205 201206 201209 201408&lt;/P&gt;
&lt;P&gt;201409 201410 201411 201412&lt;/P&gt;
&lt;P&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was:&lt;/P&gt;
&lt;P&gt;%eval(&amp;amp;yyyymm. IN 200701 200704 200810 200905 200906 200911 200912 201005 201006 201011 201012 201205 201206 201209&lt;/P&gt;
&lt;P&gt;201408 201409 201410 201411 201412)|(&amp;amp;yyyymm. &amp;gt;= 201704 &amp;amp; &amp;amp;yyyymm. &amp;lt;= 202008)&lt;/P&gt;
&lt;P&gt;2 The SAS System 11:15 Monday, July 5, 2021&lt;/P&gt;
&lt;P&gt;ERROR: The macro COMP will stop executing.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 10:24:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/EVAL-error/m-p/752047#M236835</guid>
      <dc:creator>vnreddy</dc:creator>
      <dc:date>2021-07-05T10:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: %EVAL error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/EVAL-error/m-p/752050#M236836</link>
      <description>&lt;P&gt;As always i recommend to write code without macro-statements and after the code has been tested, create a macro if necessary.&lt;/P&gt;
&lt;P&gt;If the option minoperator is active in your sas session, you could use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if &amp;amp;yyyymm. in (200701 200704 ....) %then %do; ...&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Jul 2021 10:44:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/EVAL-error/m-p/752050#M236836</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-07-05T10:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: %EVAL error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/EVAL-error/m-p/752066#M236843</link>
      <description>&lt;BR /&gt;unfortunately, no luck ended up with new error.&lt;BR /&gt;&lt;BR /&gt;ERROR: Required operator not found in expression: &amp;amp;yyyymm. in    (200701 200704  200810  200905 200906 200911 200912  201005 201006 &lt;BR /&gt;       201011 201012  201205 201206 201209   201408 201409 201410 201411 201412) |(&amp;amp;yyyymm. &amp;gt;= 201704 &amp;amp; &amp;amp;yyyymm. &amp;lt;= 202008)</description>
      <pubDate>Mon, 05 Jul 2021 11:51:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/EVAL-error/m-p/752066#M236843</guid>
      <dc:creator>vnreddy</dc:creator>
      <dc:date>2021-07-05T11:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: %EVAL error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/EVAL-error/m-p/752075#M236849</link>
      <description>&lt;P&gt;Please verify that &lt;FONT face="courier new,courier"&gt;minoperator&lt;/FONT&gt; is active.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 12:27:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/EVAL-error/m-p/752075#M236849</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-07-05T12:27:27Z</dc:date>
    </item>
    <item>
      <title>Re: %EVAL error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/EVAL-error/m-p/752082#M236851</link>
      <description>&lt;P&gt;As you probably know, the IN operator can be tricky&amp;nbsp; in macro language.&amp;nbsp; Global options have to be properly in place, and properly utilized in your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Before getting to that point, get rid of %EVAL.&amp;nbsp; It serves no purpose in your code, and just complicates the logic.&amp;nbsp; It is likely that %EVAL would not even be the correct function, and you would need to switch to %SYSEVALF.&amp;nbsp; But&amp;nbsp; you actually can get by with neither.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 12:54:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/EVAL-error/m-p/752082#M236851</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-07-05T12:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: %EVAL error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/EVAL-error/m-p/752088#M236855</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/301412"&gt;@vnreddy&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;has advised, one way to check the &lt;FONT face="courier new,courier"&gt;minoperator&lt;/FONT&gt;&amp;nbsp;(allows you to use the &lt;FONT face="courier new,courier"&gt;in&lt;/FONT&gt; operator in a macro) is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc options option=minoperator;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;As you are only using logic, the &lt;FONT face="courier new,courier"&gt;%eval&lt;/FONT&gt; is not required. If you don't want to change the global value of the &lt;FONT face="courier new,courier"&gt;minoperator&lt;/FONT&gt; option, then you can specify it as an option on the &lt;FONT face="courier new,courier"&gt;%macro&lt;/FONT&gt; statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro comp(yyyymm) / minoperator;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;More information can be found in the documentation:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/p1nypovnwon4uyn159rst8pgzqrl.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/p1nypovnwon4uyn159rst8pgzqrl.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;Amir.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 13:30:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/EVAL-error/m-p/752088#M236855</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2021-07-05T13:30:07Z</dc:date>
    </item>
  </channel>
</rss>

