<?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: SAS Error - %EVAL function or %IF in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Error-EVAL-function-or-IF/m-p/459078#M116558</link>
    <description>&lt;P&gt;Please reformat your code so it's correct, you seem to have text in the middle.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Turn on the debugging options from your program, run it and then post the full log with the errors so we can better help you debug your code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint symbolgen;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Without your data we can't run the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/207723"&gt;@sghatak&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;i keep getting the following error:-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric&lt;BR /&gt;operand is required. The condition was: E_START_DATE&amp;amp;i not in ('') and &amp;amp;CYm1=0&lt;BR /&gt;ERROR: The macro MONTHELIG will stop executing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Absolutely not able to debug this -&lt;/P&gt;
&lt;P&gt;%macro monthelig;&lt;BR /&gt;%let i=1;&lt;BR /&gt;%do %while (&amp;amp;i &amp;lt;7);&lt;BR /&gt;%let CYm1=0;&lt;BR /&gt;data test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help or suggestion, I would appreciate it very much. Thank you.&lt;BR /&gt;set test_0;&lt;BR /&gt;%if E_START_DATE&amp;amp;i not in ('') and &amp;amp;CYm1=0 %then %do;&lt;BR /&gt;if E_START_DATE&amp;amp;i&amp;lt;='01APR2018'd&amp;lt;=E_END_DATE&amp;amp;i then CYm1=1;&lt;BR /&gt;else CYm1=0;&lt;BR /&gt;%end;&lt;BR /&gt;%else %if E_START_DATE&amp;amp;i not in ('') and &amp;amp;CYm1=1 %then %do;&lt;BR /&gt;CYm1=1;&lt;BR /&gt;%END;&lt;BR /&gt;%else %if E_START_DATE&amp;amp;i in ('') and &amp;amp;CYm1=1 %then %do;&lt;BR /&gt;CYm1=1;&lt;BR /&gt;%END;&lt;BR /&gt;%else %if E_START_DATE&amp;amp;i in ('') and &amp;amp;CYm1=0 %then %do;&lt;BR /&gt;CYm1=0;&lt;BR /&gt;%end;&lt;BR /&gt;run;&lt;BR /&gt;%let i=%sysevalf(&amp;amp;i+1);&lt;BR /&gt;%put i=&amp;amp;i;&lt;BR /&gt;%end;&lt;BR /&gt;%mend monthelig;&lt;BR /&gt;%monthelig;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 01 May 2018 19:50:53 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-05-01T19:50:53Z</dc:date>
    <item>
      <title>SAS Error - %EVAL function or %IF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Error-EVAL-function-or-IF/m-p/459075#M116557</link>
      <description>&lt;P&gt;i keep getting the following error:-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric&lt;BR /&gt;operand is required. The condition was: E_START_DATE&amp;amp;i not in ('') and &amp;amp;CYm1=0&lt;BR /&gt;ERROR: The macro MONTHELIG will stop executing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Absolutely not able to debug this -&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro monthelig;
	%let i=1;

	%do %while (&amp;amp;i &amp;lt;7);
		%let CYm1=0;

		data test;
			set test_0;

			%if E_START_DATE&amp;amp;i not in ('') and &amp;amp;CYm1=0 %then
				%do;

					if E_START_DATE&amp;amp;i&amp;lt;='01APR2018'd&amp;lt;=E_END_DATE&amp;amp;i then
						CYm1=1;
					else
						CYm1=0;
				%end;
			%else %if E_START_DATE&amp;amp;i not in ('') and &amp;amp;CYm1=1 %then
				%do;
					CYm1=1;
				%END;
			%else %if E_START_DATE&amp;amp;i in ('') and &amp;amp;CYm1=1 %then
				%do;
					CYm1=1;
				%END;
			%else %if E_START_DATE&amp;amp;i in ('') and &amp;amp;CYm1=0 %then
				%do;
					CYm1=0;
				%end;
		run;

		%let i=%sysevalf(&amp;amp;i+1);
		%put i=&amp;amp;i;
	%end;
%mend monthelig;

%monthelig;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help or suggestion, I would appreciate it very much. Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 01 May 2018 20:01:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Error-EVAL-function-or-IF/m-p/459075#M116557</guid>
      <dc:creator>sghatak</dc:creator>
      <dc:date>2018-05-01T20:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Error - %EVAL function or %IF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Error-EVAL-function-or-IF/m-p/459078#M116558</link>
      <description>&lt;P&gt;Please reformat your code so it's correct, you seem to have text in the middle.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Turn on the debugging options from your program, run it and then post the full log with the errors so we can better help you debug your code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint symbolgen;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Without your data we can't run the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/207723"&gt;@sghatak&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;i keep getting the following error:-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric&lt;BR /&gt;operand is required. The condition was: E_START_DATE&amp;amp;i not in ('') and &amp;amp;CYm1=0&lt;BR /&gt;ERROR: The macro MONTHELIG will stop executing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Absolutely not able to debug this -&lt;/P&gt;
&lt;P&gt;%macro monthelig;&lt;BR /&gt;%let i=1;&lt;BR /&gt;%do %while (&amp;amp;i &amp;lt;7);&lt;BR /&gt;%let CYm1=0;&lt;BR /&gt;data test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help or suggestion, I would appreciate it very much. Thank you.&lt;BR /&gt;set test_0;&lt;BR /&gt;%if E_START_DATE&amp;amp;i not in ('') and &amp;amp;CYm1=0 %then %do;&lt;BR /&gt;if E_START_DATE&amp;amp;i&amp;lt;='01APR2018'd&amp;lt;=E_END_DATE&amp;amp;i then CYm1=1;&lt;BR /&gt;else CYm1=0;&lt;BR /&gt;%end;&lt;BR /&gt;%else %if E_START_DATE&amp;amp;i not in ('') and &amp;amp;CYm1=1 %then %do;&lt;BR /&gt;CYm1=1;&lt;BR /&gt;%END;&lt;BR /&gt;%else %if E_START_DATE&amp;amp;i in ('') and &amp;amp;CYm1=1 %then %do;&lt;BR /&gt;CYm1=1;&lt;BR /&gt;%END;&lt;BR /&gt;%else %if E_START_DATE&amp;amp;i in ('') and &amp;amp;CYm1=0 %then %do;&lt;BR /&gt;CYm1=0;&lt;BR /&gt;%end;&lt;BR /&gt;run;&lt;BR /&gt;%let i=%sysevalf(&amp;amp;i+1);&lt;BR /&gt;%put i=&amp;amp;i;&lt;BR /&gt;%end;&lt;BR /&gt;%mend monthelig;&lt;BR /&gt;%monthelig;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 May 2018 19:50:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Error-EVAL-function-or-IF/m-p/459078#M116558</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-01T19:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Error - %EVAL function or %IF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Error-EVAL-function-or-IF/m-p/459080#M116560</link>
      <description>You also seem to have both a variable and macro variable that named CYM1?</description>
      <pubDate>Tue, 01 May 2018 20:02:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Error-EVAL-function-or-IF/m-p/459080#M116560</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-01T20:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Error - %EVAL function or %IF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Error-EVAL-function-or-IF/m-p/459081#M116561</link>
      <description>&lt;P&gt;First,&amp;nbsp; you need to understand that macro language has zero ability to inspect the value of a DATA step variable.&amp;nbsp; Your code expects that it can, but it just plain can't.&amp;nbsp; Never.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Recommendation:&amp;nbsp; you would be best served by constructing a program with no macro language in it.&amp;nbsp; Use&amp;nbsp;SAS language only, and get a version of your program that works the way you would want it to when &amp;amp;i is 1.&amp;nbsp; Once you have a working DATA step, we can talk about how to write a macro language loop.&amp;nbsp; But not before.&lt;/P&gt;</description>
      <pubDate>Tue, 01 May 2018 20:04:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Error-EVAL-function-or-IF/m-p/459081#M116561</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-05-01T20:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Error - %EVAL function or %IF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Error-EVAL-function-or-IF/m-p/459084#M116564</link>
      <description>&lt;P&gt;Thank you , i could figure out the issues. Corrected code:-&lt;/P&gt;&lt;P&gt;options mprint symbolgen;&lt;BR /&gt;%macro monthelig;&lt;BR /&gt;%let CYm1=0;&lt;BR /&gt;%let i=1;&lt;BR /&gt;%do %while (&amp;amp;i &amp;lt;7);&lt;BR /&gt;data test;&lt;BR /&gt;set test_0;&lt;BR /&gt;%if E_START_DATE&amp;amp;i&amp;lt;='01APR2018'd&amp;lt;=E_END_DATE&amp;amp;i and &amp;amp;CYm1=0 %then %do;&lt;BR /&gt;CYm1=1;&lt;BR /&gt;%end;&lt;BR /&gt;%else %if E_START_DATE&amp;amp;i not in ('') and &amp;amp;CYm1=1 %then %do;&lt;BR /&gt;CYm1=1;&lt;BR /&gt;%END;&lt;BR /&gt;%else %if E_START_DATE&amp;amp;i in ('') and &amp;amp;CYm1=1 %then %do;&lt;BR /&gt;CYm1=1;&lt;BR /&gt;%END;&lt;BR /&gt;%else %if E_START_DATE&amp;amp;i in ('') and &amp;amp;CYm1=0 %then %do;&lt;BR /&gt;CYm1=0;&lt;BR /&gt;%end;&lt;BR /&gt;run;&lt;BR /&gt;%let i=%sysevalf(&amp;amp;i+1);&lt;BR /&gt;%put i=&amp;amp;i;&lt;BR /&gt;%end;&lt;BR /&gt;%mend monthelig;&lt;BR /&gt;%monthelig;&lt;/P&gt;</description>
      <pubDate>Tue, 01 May 2018 20:07:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Error-EVAL-function-or-IF/m-p/459084#M116564</guid>
      <dc:creator>sghatak</dc:creator>
      <dc:date>2018-05-01T20:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Error - %EVAL function or %IF</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Error-EVAL-function-or-IF/m-p/459190#M116606</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/207723"&gt;@sghatak&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thank you , i could figure out the issues. Corrected code:-&lt;/P&gt;
&lt;P&gt;options mprint symbolgen;&lt;BR /&gt;%macro monthelig;&lt;BR /&gt;%let CYm1=0;&lt;BR /&gt;%let i=1;&lt;BR /&gt;%do %while (&amp;amp;i &amp;lt;7);&lt;BR /&gt;data test;&lt;BR /&gt;set test_0;&lt;BR /&gt;%if E_START_DATE&amp;amp;i&amp;lt;='01APR2018'd&amp;lt;=E_END_DATE&amp;amp;i and &amp;amp;CYm1=0 %then %do;&lt;BR /&gt;CYm1=1;&lt;BR /&gt;%end;&lt;BR /&gt;%else %if E_START_DATE&amp;amp;i not in ('') and &amp;amp;CYm1=1 %then %do;&lt;BR /&gt;CYm1=1;&lt;BR /&gt;%END;&lt;BR /&gt;%else %if E_START_DATE&amp;amp;i in ('') and &amp;amp;CYm1=1 %then %do;&lt;BR /&gt;CYm1=1;&lt;BR /&gt;%END;&lt;BR /&gt;%else %if E_START_DATE&amp;amp;i in ('') and &amp;amp;CYm1=0 %then %do;&lt;BR /&gt;CYm1=0;&lt;BR /&gt;%end;&lt;BR /&gt;run;&lt;BR /&gt;%let i=%sysevalf(&amp;amp;i+1);&lt;BR /&gt;%put i=&amp;amp;i;&lt;BR /&gt;%end;&lt;BR /&gt;%mend monthelig;&lt;BR /&gt;%monthelig;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This won't work either, for the reasons &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;already gave. You need to understand what the macro&amp;nbsp;&lt;STRONG&gt;PRE&lt;/STRONG&gt;processor does before you start using it.&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2018 05:50:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Error-EVAL-function-or-IF/m-p/459190#M116606</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-05-02T05:50:33Z</dc:date>
    </item>
  </channel>
</rss>

