<?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 count all character in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/count-all-character/m-p/827117#M326699</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I defined a macrovariable:&lt;/P&gt;&lt;PRE&gt;%let InDomainWhere=&amp;gt;"30DEC2021"D;&lt;/PRE&gt;&lt;P&gt;and I need in a %if condition to count how many characters are present, how can I do that?&lt;/P&gt;&lt;P&gt;I was currently using&lt;/P&gt;&lt;PRE&gt;%if %eval(%sysfunc(count(%cmpress(&amp;amp;InDomainWhere.),%str( )))+0) = 0 %then %do;&lt;/PRE&gt;&lt;P&gt;but I realized that it only counts spaces and not all characters.&lt;/P&gt;&lt;P&gt;How can I do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Luca&lt;/P&gt;</description>
    <pubDate>Thu, 04 Aug 2022 13:20:47 GMT</pubDate>
    <dc:creator>luca87</dc:creator>
    <dc:date>2022-08-04T13:20:47Z</dc:date>
    <item>
      <title>count all character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count-all-character/m-p/827117#M326699</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I defined a macrovariable:&lt;/P&gt;&lt;PRE&gt;%let InDomainWhere=&amp;gt;"30DEC2021"D;&lt;/PRE&gt;&lt;P&gt;and I need in a %if condition to count how many characters are present, how can I do that?&lt;/P&gt;&lt;P&gt;I was currently using&lt;/P&gt;&lt;PRE&gt;%if %eval(%sysfunc(count(%cmpress(&amp;amp;InDomainWhere.),%str( )))+0) = 0 %then %do;&lt;/PRE&gt;&lt;P&gt;but I realized that it only counts spaces and not all characters.&lt;/P&gt;&lt;P&gt;How can I do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Luca&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2022 13:20:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count-all-character/m-p/827117#M326699</guid>
      <dc:creator>luca87</dc:creator>
      <dc:date>2022-08-04T13:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: count all character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count-all-character/m-p/827119#M326701</link>
      <description>&lt;P&gt;Count how many characters are present: use the %length() macro function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if %length(&amp;amp;indomainwhere)=0 %then %do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or if necessary&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if %length(%cmpres(&amp;amp;indomainwhere)) %then %do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but if &amp;amp;indomainwhere is a date, I don't see why you would need %cmpres&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2022 13:44:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count-all-character/m-p/827119#M326701</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-08-04T13:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: count all character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count-all-character/m-p/827134#M326708</link>
      <description>&lt;P&gt;You can use the %LENGTH() function to count the number of BYTES, which in a single byte encoding is the same thing.&lt;/P&gt;
&lt;P&gt;If the string in the macro variable could contain UTF-8 characters then you will need to use the KLENGTH() function to count the number of CHARACTERS.&lt;/P&gt;
&lt;PRE&gt;994   %let InDomainWhere=&amp;gt;"30DEC2021"D;
995   %let bytes=%length(&amp;amp;indomainwhere);
996   %let chars=%sysfunc(klength(%superq(indomainwhere)));
997   %put &amp;amp;=bytes &amp;amp;=chars;
BYTES=13 CHARS=13

&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Aug 2022 14:15:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count-all-character/m-p/827134#M326708</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-08-04T14:15:12Z</dc:date>
    </item>
  </channel>
</rss>

