<?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: Looking for a function which counts the number of numeric digits in a variable in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Looking-for-a-function-which-counts-the-number-of-numeric-digits/m-p/459141#M20906</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input x;
format x best.;
nbDigits = lengthn(compress(put(x, best. -l)," ","kd"));
datalines;
1
12
123
0000123
0.00123
-123
123000
;

proc print; run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;                                                   nb
                              Obs          x    Digits

                               1           1       1
                               2          12       2
                               3         123       3
                               4         123       3
                               5     0.00123       6
                               6        -123       3
                               7      123000       6
&lt;/PRE&gt;</description>
    <pubDate>Tue, 01 May 2018 22:42:53 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2018-05-01T22:42:53Z</dc:date>
    <item>
      <title>Looking for a function which counts the number of numeric digits in a variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Looking-for-a-function-which-counts-the-number-of-numeric-digits/m-p/459133#M20901</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just like the tile says, I'm&amp;nbsp;Looking for a function which counts the number of numeric digits in a variable. I&amp;nbsp; know there&amp;nbsp;is an easy answer to this question but&amp;nbsp;can't&amp;nbsp; seem to find it.&amp;nbsp; Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="159"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;ID&lt;/TD&gt;
&lt;TD width="95"&gt;&lt;FONT color="#FF6600"&gt;Number count&amp;nbsp;&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;17465&lt;/TD&gt;
&lt;TD&gt;5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;571567&lt;/TD&gt;
&lt;TD&gt;6&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;29&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;144&lt;/TD&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;5&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Tue, 01 May 2018 22:26:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Looking-for-a-function-which-counts-the-number-of-numeric-digits/m-p/459133#M20901</guid>
      <dc:creator>RobertNYC</dc:creator>
      <dc:date>2018-05-01T22:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a function which counts the number of numeric digits in a variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Looking-for-a-function-which-counts-the-number-of-numeric-digits/m-p/459136#M20902</link>
      <description>&lt;P&gt;if your id is char, length function will do&lt;/P&gt;&lt;P&gt;count=length(id);&lt;/P&gt;</description>
      <pubDate>Tue, 01 May 2018 22:34:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Looking-for-a-function-which-counts-the-number-of-numeric-digits/m-p/459136#M20902</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-05-01T22:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a function which counts the number of numeric digits in a variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Looking-for-a-function-which-counts-the-number-of-numeric-digits/m-p/459137#M20903</link>
      <description>&lt;P&gt;Sorry I should have specified ID is a numeric variable&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 May 2018 22:35:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Looking-for-a-function-which-counts-the-number-of-numeric-digits/m-p/459137#M20903</guid>
      <dc:creator>RobertNYC</dc:creator>
      <dc:date>2018-05-01T22:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a function which counts the number of numeric digits in a variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Looking-for-a-function-which-counts-the-number-of-numeric-digits/m-p/459138#M20904</link>
      <description>&lt;P&gt;AS the variable is char type you can use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;count = length(strip(ID));&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 May 2018 22:35:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Looking-for-a-function-which-counts-the-number-of-numeric-digits/m-p/459138#M20904</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-05-01T22:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a function which counts the number of numeric digits in a variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Looking-for-a-function-which-counts-the-number-of-numeric-digits/m-p/459140#M20905</link>
      <description>&lt;P&gt;Well in that case&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;&amp;nbsp;solution will work for both. However with a log note--&amp;gt;NOTE: Numeric values have been converted to character&lt;BR /&gt;values at the places given by: (Line) : (Column).&lt;/P&gt;</description>
      <pubDate>Tue, 01 May 2018 22:41:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Looking-for-a-function-which-counts-the-number-of-numeric-digits/m-p/459140#M20905</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-05-01T22:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a function which counts the number of numeric digits in a variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Looking-for-a-function-which-counts-the-number-of-numeric-digits/m-p/459141#M20906</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input x;
format x best.;
nbDigits = lengthn(compress(put(x, best. -l)," ","kd"));
datalines;
1
12
123
0000123
0.00123
-123
123000
;

proc print; run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;                                                   nb
                              Obs          x    Digits

                               1           1       1
                               2          12       2
                               3         123       3
                               4         123       3
                               5     0.00123       6
                               6        -123       3
                               7      123000       6
&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 May 2018 22:42:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Looking-for-a-function-which-counts-the-number-of-numeric-digits/m-p/459141#M20906</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-05-01T22:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a function which counts the number of numeric digits in a variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Looking-for-a-function-which-counts-the-number-of-numeric-digits/m-p/459151#M20907</link>
      <description>&lt;P&gt;Depends upon what you want! Should 000123 count as 3 digits, or six?. If it's the latter, you could use:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input x $;
  nbDigits = lengthn(compress(x,,"kd"));
  datalines;
1
12
123
123 4
0000123
0.00123
-123
123000
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 May 2018 23:53:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Looking-for-a-function-which-counts-the-number-of-numeric-digits/m-p/459151#M20907</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-05-01T23:53:04Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a function which counts the number of numeric digits in a variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Looking-for-a-function-which-counts-the-number-of-numeric-digits/m-p/459302#M20911</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id;
count=int(log10(id))+1;
cards;
17465	
571567	
29	
144	
5
;
run;
proc print;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 May 2018 13:31:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Looking-for-a-function-which-counts-the-number-of-numeric-digits/m-p/459302#M20911</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-05-02T13:31:15Z</dc:date>
    </item>
  </channel>
</rss>

