<?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: %IF Macro condition check with hyphen in argument in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/IF-Macro-condition-check-with-hyphen-in-argument/m-p/170278#M32704</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the %quote function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example &amp;amp;path\%quote(&amp;amp;supervisor)\%quote(&amp;amp;leader)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Dec 2013 16:39:32 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2013-12-11T16:39:32Z</dc:date>
    <item>
      <title>%IF Macro condition check with hyphen in argument</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-Macro-condition-check-with-hyphen-in-argument/m-p/170277#M32703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a macro that checks many conditions such as these ones:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%IF %STR(&amp;amp;LEADER) NE %STR() %THEN %DO;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%IF %SYSFUNC(FILEEXIST(&amp;amp;PATH.\&amp;amp;SUPERVISOR.\&amp;amp;LEADER.)) %THEN %DO;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the above, two of the arguments (SUPERVISOR and LEADER) can sometimes have hypens because they are names. When this happens, it yields the following error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; operand is required. The condition was: &amp;amp;LEADER NE&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any way around this or should I instruct users to remove hyphens when they call the macro?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance for your help and suggestions,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2013 16:36:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-Macro-condition-check-with-hyphen-in-argument/m-p/170277#M32703</guid>
      <dc:creator>Daniel</dc:creator>
      <dc:date>2013-12-11T16:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: %IF Macro condition check with hyphen in argument</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-Macro-condition-check-with-hyphen-in-argument/m-p/170278#M32704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the %quote function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example &amp;amp;path\%quote(&amp;amp;supervisor)\%quote(&amp;amp;leader)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2013 16:39:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-Macro-condition-check-with-hyphen-in-argument/m-p/170278#M32704</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2013-12-11T16:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: %IF Macro condition check with hyphen in argument</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-Macro-condition-check-with-hyphen-in-argument/m-p/170279#M32705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;An easy way for &amp;amp;LEADER would be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if %length(&amp;amp;leader) &amp;gt; 0 %then %do;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This could actually be abbreviated to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if %length(&amp;amp;leader) %then %do;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you sure that &amp;amp;SUPERVISOR is actually causing a problem?&amp;nbsp; It looks like it should be OK.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2013 16:53:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-Macro-condition-check-with-hyphen-in-argument/m-p/170279#M32705</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-12-11T16:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: %IF Macro condition check with hyphen in argument</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-Macro-condition-check-with-hyphen-in-argument/m-p/170280#M32706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A better way to check to see if a macro variable &amp;amp;leader is blank is:&lt;/P&gt;&lt;P&gt;%sysevalf(%superq(leader)=,boolean)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;See &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://support.sas.com/resources/papers/proceedings09/022-2009.pdf"&gt;http://support.sas.com/resources/papers/proceedings09/022-2009.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This eliminates all possible problems caused by hyphens and other special characters&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2013 17:39:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-Macro-condition-check-with-hyphen-in-argument/m-p/170280#M32706</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2013-12-11T17:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: %IF Macro condition check with hyphen in argument</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-Macro-condition-check-with-hyphen-in-argument/m-p/170281#M32707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you both for your answers, everything works fine with the modifications you have proposed &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Dec 2013 19:18:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-Macro-condition-check-with-hyphen-in-argument/m-p/170281#M32707</guid>
      <dc:creator>Daniel</dc:creator>
      <dc:date>2013-12-11T19:18:20Z</dc:date>
    </item>
  </channel>
</rss>

