<?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: Converting Decimals from Char to Numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-Decimals-from-Char-to-Numeric/m-p/814713#M321584</link>
    <description>&lt;P&gt;Why did you tell SAS to imply a decimal point before the last three digits if that was not what you wanted it to do?&amp;nbsp; That is for when you stored the strings without the decimal point to save one byte of storage.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just use a normal informat.&amp;nbsp; The INPUT() function does not care if you use a width on the informat that is larger then the length of string being read.&amp;nbsp; 32 is the maximum width for numeric informat.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;num = input(char,32.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 23 May 2022 13:54:00 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-05-23T13:54:00Z</dc:date>
    <item>
      <title>Converting Decimals from Char to Numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Decimals-from-Char-to-Numeric/m-p/814712#M321583</link>
      <description>&lt;P&gt;Seems like a very basic question, but on a Monday morning, I am struggling with this.&amp;nbsp; Trying to convert from Char to Numeric.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my code and my result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;num = input(char,8.3);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 96pt;" border="0" width="128" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="64" height="19" style="height: 14.4pt; width: 48pt;"&gt;Char&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;Num&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl63" style="height: 14.4pt;"&gt;61.93&lt;/TD&gt;
&lt;TD align="right"&gt;61.93&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl63" style="height: 14.4pt;"&gt;90&lt;/TD&gt;
&lt;TD align="right"&gt;0.09&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl63" style="height: 14.4pt;"&gt;76.88&lt;/TD&gt;
&lt;TD align="right"&gt;76.88&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;why does 90 keep turning into .09?&amp;nbsp; And how do i get around this?&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2022 13:42:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Decimals-from-Char-to-Numeric/m-p/814712#M321583</guid>
      <dc:creator>Lost_Gary</dc:creator>
      <dc:date>2022-05-23T13:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Decimals from Char to Numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Decimals-from-Char-to-Numeric/m-p/814713#M321584</link>
      <description>&lt;P&gt;Why did you tell SAS to imply a decimal point before the last three digits if that was not what you wanted it to do?&amp;nbsp; That is for when you stored the strings without the decimal point to save one byte of storage.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just use a normal informat.&amp;nbsp; The INPUT() function does not care if you use a width on the informat that is larger then the length of string being read.&amp;nbsp; 32 is the maximum width for numeric informat.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;num = input(char,32.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2022 13:54:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Decimals-from-Char-to-Numeric/m-p/814713#M321584</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-05-23T13:54:00Z</dc:date>
    </item>
  </channel>
</rss>

