<?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: ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/114342#M23552</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think for that you don't need to upcase the right-hand side (because you already typed it in upcase), you need to upcase the left side.&amp;nbsp; Intead of %superq, you can use %qupcase.&amp;nbsp; Something like:&lt;/P&gt;&lt;PRE&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp; %macro comp(qtr=);
5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if %qupcase(&amp;amp;qtr) = %str(2012-20122TESTNS) %then %put Match;
6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %else %put NO MATCH;
7&amp;nbsp;&amp;nbsp;&amp;nbsp; %mend comp;
8
9&amp;nbsp;&amp;nbsp;&amp;nbsp; %comp(qtr=2012-20122TESTNS)
Match
10&amp;nbsp;&amp;nbsp; %comp(qtr=2012-20122testns)
Match
11&amp;nbsp;&amp;nbsp; %comp(qtr=9999testns)
NO MATCH

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that with %qupcase, you need the &amp;amp; on &amp;amp;qtr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--Q.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Feb 2013 18:12:17 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2013-02-19T18:12:17Z</dc:date>
    <item>
      <title>ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/114338#M23548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am getting the following error when I use below code. Can anyone help me debug this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;code...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if &amp;amp;colloff = 084 %then %do;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %if &amp;amp;qtr = 2012-11TestNS %then %do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; libname librf "I:\Valuation\2012-12\ALICO\ProdLM\Programs\Standard\DACRollFrwd\SASLib";&lt;/P&gt;&lt;P&gt; %end;&lt;/P&gt;&lt;P&gt; %else %if &amp;amp;qtr = "2013-02Prod" %then %do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; libname librf "I:\Valuation\2013-01\ALICO\ProdLM\Programs\Standard\DACRollFrwd\SASLib";&lt;/P&gt;&lt;P&gt; %end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;log..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SYMBOLGEN:&amp;nbsp; Macro variable COLLOFF resolves to 084&lt;/P&gt;&lt;P&gt;SYMBOLGEN:&amp;nbsp; Macro variable QTR resolves to 2012-11TestNS&lt;/P&gt;&lt;P&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand &lt;/P&gt;&lt;P&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand &lt;/P&gt;&lt;P&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; is required. The condition was: %BQUOTE(&amp;amp;qtr) = 2012-11TestNS &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; is required. The condition was: %BQUOTE(&amp;amp;qtr) = 2012-11TestNS &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; is required. The condition was: %BQUOTE(&amp;amp;qtr) = 2012-11TestNS &lt;/P&gt;&lt;P&gt;ERROR: The macro MASTER will stop executing.&lt;/P&gt;&lt;P&gt;ERROR: The macro MASTER will stop executing.&lt;/P&gt;&lt;P&gt;ERROR: The macro MASTER will stop executing.&lt;/P&gt;&lt;P&gt;801&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; endsas;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2013 17:28:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/114338#M23548</guid>
      <dc:creator>helloSAS</dc:creator>
      <dc:date>2013-02-19T17:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/114339#M23549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your are correct that it's a quoting problem.&amp;nbsp; (Looks like you added %Bquote when you called the macro. )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The macro language thinks the dash in 2012-11TestNS is a subtraction sign, and tries to do subtraction with the character values, and chokes.&amp;nbsp; So you need to hide (aka mask aka quote) the values. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suggest you try:&lt;/P&gt;&lt;P&gt;&amp;nbsp; %if %superq(qtr)=%str(2012-11TestNS) %then %do;&lt;/P&gt;&lt;P&gt;(and same for the second %if, and remove the double quotes from the second %if)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So %superq() hides a dash which results from resolving &amp;amp;qtr at macro execution time, and %str() hides the dash that you can see in 2012-11TestNS at macro compile time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;--Q.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2013 17:48:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/114339#M23549</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2013-02-19T17:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/114340#M23550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ah.. thank you so much.. it works..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2013 17:53:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/114340#M23550</guid>
      <dc:creator>helloSAS</dc:creator>
      <dc:date>2013-02-19T17:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/114341#M23551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can i make it as below.. if in case my variable resolves in upper case or lowercase?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if %superq(qtr)=%str(%upcase(2012-11TESTNS)) %then %do;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2013 17:57:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/114341#M23551</guid>
      <dc:creator>helloSAS</dc:creator>
      <dc:date>2013-02-19T17:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/114342#M23552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think for that you don't need to upcase the right-hand side (because you already typed it in upcase), you need to upcase the left side.&amp;nbsp; Intead of %superq, you can use %qupcase.&amp;nbsp; Something like:&lt;/P&gt;&lt;PRE&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp; %macro comp(qtr=);
5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if %qupcase(&amp;amp;qtr) = %str(2012-20122TESTNS) %then %put Match;
6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %else %put NO MATCH;
7&amp;nbsp;&amp;nbsp;&amp;nbsp; %mend comp;
8
9&amp;nbsp;&amp;nbsp;&amp;nbsp; %comp(qtr=2012-20122TESTNS)
Match
10&amp;nbsp;&amp;nbsp; %comp(qtr=2012-20122testns)
Match
11&amp;nbsp;&amp;nbsp; %comp(qtr=9999testns)
NO MATCH

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that with %qupcase, you need the &amp;amp; on &amp;amp;qtr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--Q.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2013 18:12:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/114342#M23552</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2013-02-19T18:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/114343#M23553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was just curious and used %superq in place of %qupcase and got the below error. Can you explain me why the below did not work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;31 %macro comp(qtr=);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;32 %if %superq(&amp;amp;qtr) = %str(2012-12TESTNS) %then %put Match;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;33 %else %put NO MATCH;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;34 %mend comp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;35&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;36 %comp(qtr=2012-12TESTNS)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: Invalid symbolic variable name 2012-12TESTNS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NO MATCH&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2013 20:58:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/114343#M23553</guid>
      <dc:creator>helloSAS</dc:creator>
      <dc:date>2013-02-19T20:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/114344#M23554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One oddity of %superq is that the argument is the name of a macro variable, without the &amp;amp; sign in front.&lt;/P&gt;&lt;PRE&gt;7&amp;nbsp;&amp;nbsp;&amp;nbsp; %macro comp(qtr=);
8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if %superq(qtr) = %str(2012-12TESTNS) %then %put Match;
9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %else %put NO MATCH;
10&amp;nbsp;&amp;nbsp; %mend comp;
11
12&amp;nbsp;&amp;nbsp; %comp(qtr=2012-12TESTNS)
Match
13&amp;nbsp;&amp;nbsp; %comp(qtr=2012-12testns)
NO MATCH
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An alternative to using %qupcase would be to %upcase the value in a separated %let statement.&lt;/P&gt;&lt;PRE&gt;16&amp;nbsp;&amp;nbsp; %macro comp(qtr=);
17&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let qtr=%upcase(&amp;amp;qtr);
18&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if %superq(qtr) = %str(2012-12TESTNS) %then %put Match;
19&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %else %put NO MATCH;
20&amp;nbsp;&amp;nbsp; %mend comp;
21
22&amp;nbsp;&amp;nbsp; %comp(qtr=2012-12TESTNS)
Match
23&amp;nbsp;&amp;nbsp; %comp(qtr=2012-12testns)
Match

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Feb 2013 01:18:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/114344#M23554</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2013-02-21T01:18:53Z</dc:date>
    </item>
  </channel>
</rss>

