<?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 How to check a macro variable resolves to blank ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-a-macro-variable-resolves-to-blank/m-p/880008#M347667</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I have a very general question. Suppose if a macro variable resolves to blank then how to check that it resolved blank.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, if I have macro variable say &lt;STRONG&gt;varname&lt;/STRONG&gt;&amp;nbsp;created using&lt;STRONG&gt; into clause&lt;/STRONG&gt; of &lt;STRONG&gt;proc sql&lt;/STRONG&gt; and this variable contains two values &lt;STRONG&gt;var1 and var2&lt;/STRONG&gt;.&amp;nbsp; When I check if each of these var1 and var2 in a dataset that is containing only var1 , then in the log I get&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;SYMBOLGEN:&amp;nbsp; Macro variable VAR2 resolves to&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here, how to check if VAR2 resolved to nothing that is blank? I want to check this because based on whether it resolved or not I have to do next steps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 10 Jun 2023 14:31:37 GMT</pubDate>
    <dc:creator>Moksha</dc:creator>
    <dc:date>2023-06-10T14:31:37Z</dc:date>
    <item>
      <title>How to check a macro variable resolves to blank ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-a-macro-variable-resolves-to-blank/m-p/880008#M347667</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I have a very general question. Suppose if a macro variable resolves to blank then how to check that it resolved blank.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, if I have macro variable say &lt;STRONG&gt;varname&lt;/STRONG&gt;&amp;nbsp;created using&lt;STRONG&gt; into clause&lt;/STRONG&gt; of &lt;STRONG&gt;proc sql&lt;/STRONG&gt; and this variable contains two values &lt;STRONG&gt;var1 and var2&lt;/STRONG&gt;.&amp;nbsp; When I check if each of these var1 and var2 in a dataset that is containing only var1 , then in the log I get&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;SYMBOLGEN:&amp;nbsp; Macro variable VAR2 resolves to&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here, how to check if VAR2 resolved to nothing that is blank? I want to check this because based on whether it resolved or not I have to do next steps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 14:31:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-a-macro-variable-resolves-to-blank/m-p/880008#M347667</guid>
      <dc:creator>Moksha</dc:creator>
      <dc:date>2023-06-10T14:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to check a macro variable resolves to blank ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-a-macro-variable-resolves-to-blank/m-p/880011#M347669</link>
      <description>&lt;P&gt;I have used the following and it worked:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if %length(&amp;amp;varname) ne 0 %then %do;
    statements.....
%end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please, let me know if there are any other better ways to do this instead of using %length().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 14:49:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-a-macro-variable-resolves-to-blank/m-p/880011#M347669</guid>
      <dc:creator>Moksha</dc:creator>
      <dc:date>2023-06-10T14:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to check a macro variable resolves to blank ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-a-macro-variable-resolves-to-blank/m-p/880012#M347670</link>
      <description>&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings09/022-2009.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings09/022-2009.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 15:16:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-a-macro-variable-resolves-to-blank/m-p/880012#M347670</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-06-10T15:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to check a macro variable resolves to blank ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-a-macro-variable-resolves-to-blank/m-p/880015#M347673</link>
      <description>&lt;P&gt;Define BLANK.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to test if it is empty then length of zero is the best way.&amp;nbsp; That will let you tell the difference between an empty string and one that only contains blanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%length(&amp;amp;param)=0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to test if it only contains spaces then the paper by Chung and King linked above is what you want to check out.&amp;nbsp; Their recommendation is&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%sysevalf(%superq(param)=,boolean)&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 16:03:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-a-macro-variable-resolves-to-blank/m-p/880015#M347673</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-06-10T16:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to check a macro variable resolves to blank ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-a-macro-variable-resolves-to-blank/m-p/880029#M347682</link>
      <description>&lt;P&gt;Thank you very much. That's very useful information. It helped me a lot.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 17:23:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-a-macro-variable-resolves-to-blank/m-p/880029#M347682</guid>
      <dc:creator>Moksha</dc:creator>
      <dc:date>2023-06-10T17:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to check a macro variable resolves to blank ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-a-macro-variable-resolves-to-blank/m-p/880031#M347683</link>
      <description>&lt;P&gt;Thank you very much for providing other better ways to check this. These suggestions are very very helpful.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 17:26:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-a-macro-variable-resolves-to-blank/m-p/880031#M347683</guid>
      <dc:creator>Moksha</dc:creator>
      <dc:date>2023-06-10T17:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to check a macro variable resolves to blank ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-a-macro-variable-resolves-to-blank/m-p/880033#M347685</link>
      <description>&lt;P&gt;I used to do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if "&amp;amp;varname." = ""&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Jun 2023 18:09:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-a-macro-variable-resolves-to-blank/m-p/880033#M347685</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-06-10T18:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to check a macro variable resolves to blank ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-a-macro-variable-resolves-to-blank/m-p/880045#M347695</link>
      <description>&lt;P&gt;Thank you for your valuable suggestion.&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 10:29:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-a-macro-variable-resolves-to-blank/m-p/880045#M347695</guid>
      <dc:creator>Moksha</dc:creator>
      <dc:date>2023-06-11T10:29:31Z</dc:date>
    </item>
  </channel>
</rss>

