<?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 find the number of alphabet and non-alphabet letters in a string? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-number-of-alphabet-and-non-alphabet-letters-in-a/m-p/846232#M334551</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;n_alpha = length(compress(string, , 'ka'));
n_non_alpha = length(compress(string, , 'a'));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Probably need to test if that accounts for spaces correctly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.2/lefunctionsref/n0fcshr0ir3h73n1b845c4aq58hz.htm" target="_self"&gt;Compress function is documented here&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Nov 2022 23:02:48 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2022-11-24T23:02:48Z</dc:date>
    <item>
      <title>How to find the number of alphabet and non-alphabet letters in a string?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-number-of-alphabet-and-non-alphabet-letters-in-a/m-p/846231#M334550</link>
      <description />
      <pubDate>Thu, 24 Nov 2022 22:33:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-number-of-alphabet-and-non-alphabet-letters-in-a/m-p/846231#M334550</guid>
      <dc:creator>xyxu</dc:creator>
      <dc:date>2022-11-24T22:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the number of alphabet and non-alphabet letters in a string?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-number-of-alphabet-and-non-alphabet-letters-in-a/m-p/846232#M334551</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;n_alpha = length(compress(string, , 'ka'));
n_non_alpha = length(compress(string, , 'a'));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Probably need to test if that accounts for spaces correctly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.2/lefunctionsref/n0fcshr0ir3h73n1b845c4aq58hz.htm" target="_self"&gt;Compress function is documented here&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2022 23:02:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-number-of-alphabet-and-non-alphabet-letters-in-a/m-p/846232#M334551</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-11-24T23:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the number of alphabet and non-alphabet letters in a string?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-number-of-alphabet-and-non-alphabet-letters-in-a/m-p/846298#M334579</link>
      <description>&lt;P&gt;Assuming that non-letters include spaces, punctuation, numbers, etc, you can use the ANYALPHA function to&amp;nbsp; differentiate letters from nonletters:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
length s $72;
input s 1-72;
/* number of letters and non-letters */
L = length(s);
nLetters = 0;
nNonLetters = 0;
do i = 1 to L;
isLetter = anyalpha(substr(s, i, 1));
nLetters + isLetter;
nNonLetters + ^isLetter;
end;
output;
drop i isLetter;
datalines;
In 28 days, the Anglo-Saxon lord ate 134 carrots. He had 20/20 vision!
e^{i*pi} + 1 = 0
ABCDEFG 123 HIJK 456 LMNOP 789 QRSTUV 0 WXYZ
;

proc print; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 25 Nov 2022 11:06:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-number-of-alphabet-and-non-alphabet-letters-in-a/m-p/846298#M334579</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-11-25T11:06:42Z</dc:date>
    </item>
  </channel>
</rss>

