<?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: Length of numeric variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Length-of-numeric-variable/m-p/369081#M275508</link>
    <description>&lt;P&gt;Adding to Kurt&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need greater precision you might try using SAS DS2 - references&amp;nbsp;&lt;A href="http://blogs.sas.com/content/sgf/2016/02/19/reasons-love-proc-ds2/" target="_self"&gt;here&lt;/A&gt;&amp;nbsp;and&amp;nbsp;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/69739/HTML/default/viewer.htm#n0v130wmh3hmuzn1t7y5y4pgxa69.htm" target="_self"&gt;here&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Jun 2017 09:53:52 GMT</pubDate>
    <dc:creator>ChrisBrooks</dc:creator>
    <dc:date>2017-06-21T09:53:52Z</dc:date>
    <item>
      <title>Length of numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Length-of-numeric-variable/m-p/368774#M275503</link>
      <description>&lt;P&gt;I have numeric variable with decimals&lt;BR /&gt;&lt;BR /&gt;data l;&lt;BR /&gt;input number;&lt;BR /&gt;cards;&lt;BR /&gt;54498.014&lt;BR /&gt;17188.12647&lt;BR /&gt;54545&lt;BR /&gt;211151.127287128718&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;need to see&amp;nbsp;the length of numeric variable in SAS SQL commond without put commond or with commond along with suppressing addional zeros.&lt;/P&gt;&lt;P&gt;Can any one help me to code this in SAS SQL please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Number &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Length&lt;BR /&gt;54498.014 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 9&lt;BR /&gt;17188.12647 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;11&lt;BR /&gt;54545 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5&lt;BR /&gt;211151.127312345 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 16&lt;/P&gt;&lt;P&gt;123456789012345678.1 &amp;nbsp;20 &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 15:11:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Length-of-numeric-variable/m-p/368774#M275503</guid>
      <dc:creator>prakashpk</dc:creator>
      <dc:date>2017-06-20T15:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: Length of numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Length-of-numeric-variable/m-p/368794#M275504</link>
      <description>&lt;P&gt;At least your last example won't work, as SAS numeric values have a precision of ~15 digits.&lt;/P&gt;
&lt;P&gt;Google "SAS numeric precision" for in-depth information.&lt;/P&gt;
&lt;P&gt;Otherwise, you can only determine the length from strings, and therefore will need the put() function.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 15:44:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Length-of-numeric-variable/m-p/368794#M275504</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-20T15:44:11Z</dc:date>
    </item>
    <item>
      <title>Re: Length of numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Length-of-numeric-variable/m-p/368810#M275505</link>
      <description>&lt;P&gt;Adding to Kurt,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can read in the data as a character variable and just use the length function in the data step.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data l;
input number $50.;
number_length = length(number);
cards;
54498.014
17188.12647
54545
211151.127287128718
123456789012345678.1
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 16:04:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Length-of-numeric-variable/m-p/368810#M275505</guid>
      <dc:creator>Rwon</dc:creator>
      <dc:date>2017-06-20T16:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: Length of numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Length-of-numeric-variable/m-p/369037#M275506</link>
      <description>&lt;P&gt;Thank you Rwon&lt;SPAN class=""&gt;&amp;nbsp;for your reply &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Actually i know how to write in Data step, but i want to understand how it is written in SAS SQL format as i have data which comes from the server and need to see one of the attribute length, whether it is exceeding 19 which includes . and decimals. or&amp;nbsp;number contains more than 6 decimal numbers. can you please send me SAS SQL code which i can use for this case.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Prakash&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 07:53:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Length-of-numeric-variable/m-p/369037#M275506</guid>
      <dc:creator>prakashpk</dc:creator>
      <dc:date>2017-06-21T07:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Length of numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Length-of-numeric-variable/m-p/369040#M275507</link>
      <description>&lt;P&gt;I guess that by "server" you mean a database system? In that case, you have a problem, as 19 digits go beyond the maximum precision available to SAS (~15 digits, as already mentioned), and numbers like that will not be correctly represented in SAS anyway.&lt;/P&gt;
&lt;P&gt;I suggest you do a typecast in the database (SQL pass-through), and import into SAS as strings (character).&lt;/P&gt;
&lt;P&gt;Or you have the table exported to a flat file from the DBMS, and then read the column as character with a SAS data step.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 08:03:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Length-of-numeric-variable/m-p/369040#M275507</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-21T08:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: Length of numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Length-of-numeric-variable/m-p/369081#M275508</link>
      <description>&lt;P&gt;Adding to Kurt&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need greater precision you might try using SAS DS2 - references&amp;nbsp;&lt;A href="http://blogs.sas.com/content/sgf/2016/02/19/reasons-love-proc-ds2/" target="_self"&gt;here&lt;/A&gt;&amp;nbsp;and&amp;nbsp;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/69739/HTML/default/viewer.htm#n0v130wmh3hmuzn1t7y5y4pgxa69.htm" target="_self"&gt;here&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 09:53:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Length-of-numeric-variable/m-p/369081#M275508</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2017-06-21T09:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: Length of numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Length-of-numeric-variable/m-p/369084#M275509</link>
      <description>&lt;P&gt;The closest you'll get using proc sql is:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;select length(NUMBER,best32. -l) from HAVE;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;but that's a weird request, and you'll get surprises due to numeric precision as explained above.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 10:05:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Length-of-numeric-variable/m-p/369084#M275509</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-06-21T10:05:26Z</dc:date>
    </item>
  </channel>
</rss>

