<?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 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/642400#M191625</link>
    <description>&lt;P&gt;I'm trying appling this macro:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%MACRO EXPOSICOES(TABELA,VL_PMT,EXPOSICAO,VAR_PROVISAO,CONDICAO);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; PROC SQL;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; CREATE TABLE SALDO_&amp;amp;TABELA. AS&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SELECT CPFCNPJ,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %IF &amp;amp;TABELA NOT IN (OUTROS,AGRO,CHEQUE) %THEN %DO;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SUM(&amp;amp;VL_PMT.) AS PMT_&amp;amp;TABELA.,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; %END;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; MAX(DIAS_ATRASO) AS DIAS_ATRASO_&amp;amp;TABELA.,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; FROM TABELA WHERE CPFCNPJ &amp;gt; 0&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; GROUP BY CPFCNPJ&lt;BR /&gt;;QUIT;&lt;BR /&gt;%MEND EXPOSICOES;&lt;BR /&gt;%EXPOSICOES(OUTROS,.,TABELA,VAR_PROVISAO)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;however i always get this message 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;BR /&gt;&amp;amp;TABELA NOT IN (OUTROS,AGRO,CHEQUE)&lt;BR /&gt;ERROR: The macro EXPOSICOES will stop executing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;anyone could help me? &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 23 Apr 2020 20:48:55 GMT</pubDate>
    <dc:creator>erickdt</dc:creator>
    <dc:date>2020-04-23T20:48:55Z</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/642400#M191625</link>
      <description>&lt;P&gt;I'm trying appling this macro:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%MACRO EXPOSICOES(TABELA,VL_PMT,EXPOSICAO,VAR_PROVISAO,CONDICAO);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; PROC SQL;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; CREATE TABLE SALDO_&amp;amp;TABELA. AS&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SELECT CPFCNPJ,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %IF &amp;amp;TABELA NOT IN (OUTROS,AGRO,CHEQUE) %THEN %DO;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SUM(&amp;amp;VL_PMT.) AS PMT_&amp;amp;TABELA.,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; %END;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; MAX(DIAS_ATRASO) AS DIAS_ATRASO_&amp;amp;TABELA.,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; FROM TABELA WHERE CPFCNPJ &amp;gt; 0&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; GROUP BY CPFCNPJ&lt;BR /&gt;;QUIT;&lt;BR /&gt;%MEND EXPOSICOES;&lt;BR /&gt;%EXPOSICOES(OUTROS,.,TABELA,VAR_PROVISAO)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;however i always get this message 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;BR /&gt;&amp;amp;TABELA NOT IN (OUTROS,AGRO,CHEQUE)&lt;BR /&gt;ERROR: The macro EXPOSICOES will stop executing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;anyone could help me? &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Apr 2020 20:48: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/642400#M191625</guid>
      <dc:creator>erickdt</dc:creator>
      <dc:date>2020-04-23T20:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric oper</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/642413#M191634</link>
      <description>&lt;P&gt;I suspect its the NOT IN that's causing you issues, this is a known common issue if you search for it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would recommend switching to multiple AND or look into MINOPERATOR.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; %IF &amp;amp;TABELA !=OUTROS and &amp;amp;TABELA != AGRO and &amp;amp;TABELA != CHEQUE %THEN %DO;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=p0pbehl7wj5sl4n1ov1ortnehtba.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en"&gt;https://documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=p0pbehl7wj5sl4n1ov1ortnehtba.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&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/278427"&gt;@erickdt&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm trying appling this macro:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%MACRO EXPOSICOES(TABELA,VL_PMT,EXPOSICAO,VAR_PROVISAO,CONDICAO);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; PROC SQL;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; CREATE TABLE SALDO_&amp;amp;TABELA. AS&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SELECT CPFCNPJ,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %IF &amp;amp;TABELA NOT IN (OUTROS,AGRO,CHEQUE) %THEN %DO;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SUM(&amp;amp;VL_PMT.) AS PMT_&amp;amp;TABELA.,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; %END;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; MAX(DIAS_ATRASO) AS DIAS_ATRASO_&amp;amp;TABELA.,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; FROM TABELA WHERE CPFCNPJ &amp;gt; 0&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; GROUP BY CPFCNPJ&lt;BR /&gt;;QUIT;&lt;BR /&gt;%MEND EXPOSICOES;&lt;BR /&gt;%EXPOSICOES(OUTROS,.,TABELA,VAR_PROVISAO)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;however i always get this message 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;BR /&gt;&amp;amp;TABELA NOT IN (OUTROS,AGRO,CHEQUE)&lt;BR /&gt;ERROR: The macro EXPOSICOES will stop executing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;anyone could help me? &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Apr 2020 22:24:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/642413#M191634</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-04-23T22:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric oper</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/642416#M191636</link>
      <description>&lt;P&gt;You have a couple of problems with your macro. Like&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;mentioned, you'd have to use the minoperator option to us the in operator in a macro. Plus, you would have to change the way you use the operator.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Plus you have an extra comma in your proc sql code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;MAX(DIAS_ATRASO) AS DIAS_ATRASO_&amp;amp;TABELA.,&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And what are you trying to accomplish with the sum function?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, you declare a fifth parameter in your macro, but only include four values when you call the macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the code I ran:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data tabela;
  input cpfcnpj dias_atraso;
  cards;
1 1
1 2
1 3
1 4
2 2
2 4
2 6
2 8
;
run;

options minoperator;
%MACRO EXPOSICOES(TABELA,VL_PMT,EXPOSICAO,VAR_PROVISAO,CONDICAO);
    PROC SQL;
      CREATE TABLE SALDO_&amp;amp;TABELA. AS
      SELECT CPFCNPJ,
        %IF  NOT (&amp;amp;TABELA IN OUTROS AGRO CHEQUE) %THEN %DO;
            SUM(&amp;amp;VL_PMT.)  AS PMT_&amp;amp;TABELA.,
        %END;
        MAX(DIAS_ATRASO) AS DIAS_ATRASO_&amp;amp;TABELA. /*,*/
    FROM TABELA WHERE CPFCNPJ &amp;gt; 0 
    GROUP BY CPFCNPJ
  ;
QUIT;
%MEND EXPOSICOES;

%EXPOSICOES(OUTROS,.,TABELA,VAR_PROVISAO)
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Apr 2020 22:45:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/642416#M191636</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2020-04-23T22:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric oper</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/642536#M191701</link>
      <description>&lt;P&gt;art297, thx so much, it's working now...&lt;/P&gt;&lt;P&gt;answering your questions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;1 - I haven't put my complete query here, i need make this query more than 5 times,&amp;nbsp; so the max function will work for another "product" &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;2 - as mentioned "condicao" is a condition from another products...&lt;/P&gt;&lt;P&gt;Thanks for the fast repliyng!!!! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2020 11:50:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/642536#M191701</guid>
      <dc:creator>erickdt</dc:creator>
      <dc:date>2020-04-24T11:50:18Z</dc:date>
    </item>
  </channel>
</rss>

