<?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: A character operand was found in the %EVAL function or %IF condition where a numeric operand is in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/760768#M240604</link>
    <description>&lt;P&gt;My first try was not the issue.&amp;nbsp; Try wrapping the left side of the equation in %BQUOTE.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This seems to be working for me:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let indir=//folder/path;
%PUT &amp;amp;indir;
%if %bquote(%substr(&amp;amp;indir,%length(&amp;amp;indir),1)) ^= %bquote(/) %then 
	%DO;
		%let indir=&amp;amp;indir/;
	%END;
%else
	%DO;
		%put	NOTE:  No action taken;
	%END;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
    <pubDate>Tue, 10 Aug 2021 22:29:39 GMT</pubDate>
    <dc:creator>jimbarbour</dc:creator>
    <dc:date>2021-08-10T22:29:39Z</dc:date>
    <item>
      <title>A character operand was found in the %EVAL function or %IF condition where a numeric operand is req</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/760762#M240599</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting an error using following code. please help what am I missing ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let indir=//folder/path;&lt;/P&gt;&lt;P&gt;%PUT &amp;amp;indir;&lt;/P&gt;&lt;P&gt;%if %substr(&amp;amp;indir,%length(&amp;amp;indir),1)^=/ %then %let indir=&amp;amp;indir/;&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 operand is required. The condition was:&lt;BR /&gt;T^=/&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 21:52:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/760762#M240599</guid>
      <dc:creator>arunr</dc:creator>
      <dc:date>2021-08-10T21:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: A character operand was found in the %EVAL function or %IF condition where a numeric operand is</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/760763#M240600</link>
      <description>&lt;P&gt;Something returned from your functions is coming back as character instead of numeric.&amp;nbsp; You might try doing a STRIP for the data you're trying to get the length of.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 22:23:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/760763#M240600</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-08-10T22:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: A character operand was found in the %EVAL function or %IF condition where a numeric operand is</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/760764#M240601</link>
      <description>&lt;P&gt;It appears that the bare / character may be treated as expecting division (numeric)&lt;/P&gt;
&lt;P&gt;See if&amp;nbsp; forcing quotes does what you expect:&lt;/P&gt;
&lt;PRE&gt;%if %quote(%substr(&amp;amp;indir,%length(&amp;amp;indir)))^= "/" %then %let indir=&amp;amp;indir/;
&lt;/PRE&gt;
&lt;P&gt;When the second parameter of Substr is the length of the variable you get the last character, so the ,1 isn't needed.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 22:12:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/760764#M240601</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-08-10T22:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: A character operand was found in the %EVAL function or %IF condition where a numeric operand is</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/760767#M240603</link>
      <description>&lt;P&gt;%EVAL() is looking for the numbers you want to divide.&amp;nbsp; Macro quoting helps.&lt;/P&gt;
&lt;PRE&gt;904   %if /=/ %then %do;
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was:
       /=/
ERROR: Skipping to next %END statement.
905     %put equal;
906   %end;
907   %if %str(/)=%str(/) %then %do;
908     %put equal;
equal
909   %end;
&lt;/PRE&gt;
&lt;P&gt;So add macro quoting on both sides of the operator.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if %qsubstr(&amp;amp;indir,%length(&amp;amp;indir))^=%str(/) %then %let indir=&amp;amp;indir/;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 22:29:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/760767#M240603</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-10T22:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: A character operand was found in the %EVAL function or %IF condition where a numeric operand is</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/760768#M240604</link>
      <description>&lt;P&gt;My first try was not the issue.&amp;nbsp; Try wrapping the left side of the equation in %BQUOTE.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This seems to be working for me:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let indir=//folder/path;
%PUT &amp;amp;indir;
%if %bquote(%substr(&amp;amp;indir,%length(&amp;amp;indir),1)) ^= %bquote(/) %then 
	%DO;
		%let indir=&amp;amp;indir/;
	%END;
%else
	%DO;
		%put	NOTE:  No action taken;
	%END;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 22:29:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/760768#M240604</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-08-10T22:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: A character operand was found in the %EVAL function or %IF condition where a numeric operand is</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/760793#M240617</link>
      <description>&lt;P&gt;That cannot work.&amp;nbsp; You are comparing a one character string to a three character string.&amp;nbsp; They will never be equal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Either add real quotes to both sides.&lt;/P&gt;
&lt;P&gt;Or add macro quoting to both sides.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Aug 2021 02:56:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/760793#M240617</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-11T02:56:34Z</dc:date>
    </item>
    <item>
      <title>Re: A character operand was found in the %EVAL function or %IF condition where a numeric operand is</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/845201#M334117</link>
      <description>&lt;P&gt;Beautiful.&amp;nbsp; %quote() comes to the rescue!&amp;nbsp; Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 20:35:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-character-operand-was-found-in-the-EVAL-function-or-IF/m-p/845201#M334117</guid>
      <dc:creator>KentL</dc:creator>
      <dc:date>2022-11-18T20:35:35Z</dc:date>
    </item>
  </channel>
</rss>

