<?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: How to check if the list is empty in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-if-the-list-is-empty/m-p/800624#M315006</link>
    <description>&lt;P&gt;Use a proper macro quoting function or make sure that the &amp;amp;list macro variable is available in the local symbol table for your macro (i.e. create it inside the macro def).&lt;/P&gt;</description>
    <pubDate>Mon, 07 Mar 2022 11:22:48 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2022-03-07T11:22:48Z</dc:date>
    <item>
      <title>How to check if the list is empty</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-if-the-list-is-empty/m-p/800620#M315003</link>
      <description>&lt;P&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN&gt;Hello.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class=""&gt;I have the following problem with sas list:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let List =;
%let N_List = %sysfunc(countw(&amp;amp;List));

533 %let List =;
534 %let N_List = %sysfunc(countw(&amp;amp;List));
ERROR: The function COUNTW referenced by the %SYSFUNC or %QSYSFUNC macro function has too few
arguments&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if &amp;amp;list =  %then %do;
..
%end;

ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric 
       operand is required. The condition was: &amp;amp;list = &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to check if the list is empty???&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;Thank you very much for all your help&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 15:35:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-if-the-list-is-empty/m-p/800620#M315003</guid>
      <dc:creator>makset</dc:creator>
      <dc:date>2022-03-07T15:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if the list is empty</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-if-the-list-is-empty/m-p/800623#M315005</link>
      <description>&lt;LI-CODE lang="sas"&gt;%if %superq(list) =  %then %do;
...
%end;&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 07 Mar 2022 11:21:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-if-the-list-is-empty/m-p/800623#M315005</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2022-03-07T11:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if the list is empty</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-if-the-list-is-empty/m-p/800624#M315006</link>
      <description>&lt;P&gt;Use a proper macro quoting function or make sure that the &amp;amp;list macro variable is available in the local symbol table for your macro (i.e. create it inside the macro def).&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 11:22:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-if-the-list-is-empty/m-p/800624#M315006</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-03-07T11:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if the list is empty</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-if-the-list-is-empty/m-p/800678#M315025</link>
      <description>&lt;P&gt;If you give %SYSFUNC() at least two arguments then it will not cause the COUNTW() function to issue that error.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;937   %let List =;
938   %let N_List = %sysfunc(countw(&amp;amp;List,));
939   %put &amp;amp;=n_list;
N_LIST=0
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But you really should be telling COUNTW() what delimiters to use.&amp;nbsp; For example a space.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let N_List = %sysfunc(countw(&amp;amp;List,%str( )));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Otherwise it uses multiple characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;the default delimiters depend on whether your computer uses ASCII or EBCDIC characters.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;DIV class="xis-listUnordered"&gt;
&lt;BLOCKQUOTE&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV id="n0pwim87ric6ejn1uxaaemxltnbl" class="xis-item"&gt;
&lt;DIV id="p1j0z97pyrmr13n1osijo71rxt7a" class="xis-paraSimpleFirst"&gt;If your computer uses ASCII characters, then the default delimiters are as follows:&lt;/DIV&gt;
&lt;DIV id="n165p8dnduyv2nn14d1vse3j163a" class="xis-paraSimple"&gt;&lt;FONT face="courier new,courier"&gt;blank ! $ % &amp;amp; ( ) * + , - . / ; &amp;lt; ^ |&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV id="n1jioswq56e6z6n1n07vuymxl0b6" class="xis-paraSimple"&gt;In ASCII environments that do not contain the ^ character, the SCAN function uses the ~ character instead.&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV id="n0i2loer55bijnn162nfbmeox3ca" class="xis-item"&gt;
&lt;DIV id="p0919kop5ok99vn1kbg6olfsd9fu" class="xis-paraSimpleFirst"&gt;If your computer uses EBCDIC characters, then the default delimiters are as follows:&lt;/DIV&gt;
&lt;DIV id="n0snopwlc432enn1vligialqjeo1" class="xis-paraSimple"&gt;&lt;FONT face="courier new,courier"&gt;blank ! $ % &amp;amp; ( ) * + , - . / ; &amp;lt; ¬ | ¢&lt;/FONT&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;/BLOCKQUOTE&gt;
&lt;/DIV&gt;
&lt;P&gt;To simply test if the sting is empty I normally just test for non-zero length.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if %length(&amp;amp;list) %then ...&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Mar 2022 15:45:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-if-the-list-is-empty/m-p/800678#M315025</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-03-07T15:45:28Z</dc:date>
    </item>
  </channel>
</rss>

