<?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 Convert Amount field from character to numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-Amount-field-from-character-to-numeric/m-p/650596#M195101</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to convert an amount field from character to numeric using input function but unable to do.&lt;/P&gt;&lt;P&gt;Getting error Invalid argument to input function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried commaw.d , bestw.d informats as well but its not working.&lt;/P&gt;&lt;P&gt;amount=input(amount_old,20.2);&lt;/P&gt;&lt;P&gt;example: data in amount_old field&lt;/P&gt;&lt;P&gt;23.45&lt;/P&gt;&lt;P&gt;12,300.56&lt;/P&gt;&lt;P&gt;123,123.23&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Tue, 26 May 2020 04:59:57 GMT</pubDate>
    <dc:creator>Leonoids</dc:creator>
    <dc:date>2020-05-26T04:59:57Z</dc:date>
    <item>
      <title>Convert Amount field from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Amount-field-from-character-to-numeric/m-p/650596#M195101</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to convert an amount field from character to numeric using input function but unable to do.&lt;/P&gt;&lt;P&gt;Getting error Invalid argument to input function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried commaw.d , bestw.d informats as well but its not working.&lt;/P&gt;&lt;P&gt;amount=input(amount_old,20.2);&lt;/P&gt;&lt;P&gt;example: data in amount_old field&lt;/P&gt;&lt;P&gt;23.45&lt;/P&gt;&lt;P&gt;12,300.56&lt;/P&gt;&lt;P&gt;123,123.23&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2020 04:59:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Amount-field-from-character-to-numeric/m-p/650596#M195101</guid>
      <dc:creator>Leonoids</dc:creator>
      <dc:date>2020-05-26T04:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Amount field from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Amount-field-from-character-to-numeric/m-p/650600#M195102</link>
      <description>&lt;P&gt;Not sure what you have been doing, but this seems to work fine:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  length amount_old $20;
  input amount_old;
  amount=input(amount_old,comma20.2);
cards;
23.45
12,300.56
123,123.23
;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 May 2020 06:14:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Amount-field-from-character-to-numeric/m-p/650600#M195102</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2020-05-26T06:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Amount field from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Amount-field-from-character-to-numeric/m-p/650622#M195114</link>
      <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;dollar.&lt;/FONT&gt; informat is the most flexible one. It handles commas, dollar signs and plain numbers.&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2020 07:44:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Amount-field-from-character-to-numeric/m-p/650622#M195114</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-05-26T07:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Amount field from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Amount-field-from-character-to-numeric/m-p/651049#M195286</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;I can able to convert from char to numeric while creating dataset using datalines.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have pipe delimited file in which trying to process the data but its not happening.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data one;&lt;/P&gt;&lt;P&gt;infile "filename" delimiter='|' missover dsd lrecl=2000;&lt;/P&gt;&lt;P&gt;informat amount comma26.2;&lt;/P&gt;&lt;P&gt;length amount 8;&lt;/P&gt;&lt;P&gt;input amount;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;error: Invalid data for amount&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 11:51:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Amount-field-from-character-to-numeric/m-p/651049#M195286</guid>
      <dc:creator>Leonoids</dc:creator>
      <dc:date>2020-05-27T11:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Amount field from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Amount-field-from-character-to-numeric/m-p/651051#M195288</link>
      <description>&lt;P&gt;for the above, if I am keeping amount column as character I can able to create the dataset without any errors. once the dataset creates, trying to convert amount field from char to numeric, getting error invalid argument to input function.&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 11:55:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Amount-field-from-character-to-numeric/m-p/651051#M195288</guid>
      <dc:creator>Leonoids</dc:creator>
      <dc:date>2020-05-27T11:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Amount field from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Amount-field-from-character-to-numeric/m-p/651096#M195315</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;dollar.&lt;/FONT&gt; informat is the most flexible one. It handles commas, dollar signs and plain numbers.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The DOLLAR informat is just an alias for the COMMA informat.&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 14:16:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Amount-field-from-character-to-numeric/m-p/651096#M195315</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-05-27T14:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Amount field from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Amount-field-from-character-to-numeric/m-p/651097#M195316</link>
      <description>&lt;P&gt;Did you really intend to divide the integer values by 100?&amp;nbsp; If not then do NOT include a decimal part in the INFORMAT.&amp;nbsp; The purpose of the decimal part of an informat is to tell SAS that the decimal point is explicitly NOT present in the data to save one character in representing the number as text.&amp;nbsp; The maximum width that the COMMA informat supports is 32 and the INPUT() function does not mind if the width you use on the informat is larger than the length of the string you are reading.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;amount=input(amount_old,comma32.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 14:31:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Amount-field-from-character-to-numeric/m-p/651097#M195316</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-05-27T14:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Amount field from character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-Amount-field-from-character-to-numeric/m-p/651240#M195372</link>
      <description>So it is! Thank you!&lt;BR /&gt;</description>
      <pubDate>Wed, 27 May 2020 23:05:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-Amount-field-from-character-to-numeric/m-p/651240#M195372</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-05-27T23:05:26Z</dc:date>
    </item>
  </channel>
</rss>

