<?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: convert char to numeric and recognize correct informat in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/convert-char-to-numeric-and-recognize-correct-informat/m-p/633563#M187946</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I don't understand. Can you try to explain it again please?&lt;BR /&gt;char value 123,456.78 has decimal point.&lt;BR /&gt;what should be the informat?&lt;BR /&gt;Is it possible that there are multiple informats that can be used in this example?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Only include a number of decimal places on the INFORMAT if you want SAS to imply where the decimal point should be when the string being read does NOT contain one.&amp;nbsp; So with 32.2 as the INFORMAT the string '1234567' will become the number 12,345.67.&amp;nbsp; But if the string has a decimal point the number of decimal places listed in the informat is ignored.&amp;nbsp; So a string like '1234.567' becomes the number 1,234.567&lt;/P&gt;</description>
    <pubDate>Fri, 20 Mar 2020 14:21:25 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-03-20T14:21:25Z</dc:date>
    <item>
      <title>convert char to numeric and recognize correct informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-char-to-numeric-and-recognize-correct-informat/m-p/633552#M187938</link>
      <description>&lt;LI-SPOILER&gt;
&lt;LI-SPOILER&gt;&amp;nbsp;&lt;/LI-SPOILER&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I am trying to learn the topic of convert char to numeric.&lt;/P&gt;
&lt;P&gt;I know the formula:&amp;nbsp;Numeric=INPUT(char, informat);&lt;/P&gt;
&lt;P&gt;My problem is that sometimes it is difficult for me to recognize the in informat.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;For example:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;convert char value &amp;nbsp;&amp;nbsp;123,456.78 &amp;nbsp;&amp;nbsp;to &amp;nbsp;&amp;nbsp;numeric.&lt;/P&gt;
&lt;P&gt;I saw that the solution is&amp;nbsp;Numeric=INPUT(char, COMMA12.);&lt;/P&gt;
&lt;P&gt;Numeric value returned 123456.78 &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My question is why the informat is&amp;nbsp;COMMA12.?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see that there are 2 numbers after the point and 6 numbers before the point.&lt;/P&gt;
&lt;P&gt;I was sure that the informat should be comma6.2&amp;nbsp; because there are 6 numbers in left of point and 2 in right of point&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;For example:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;There are 2 records under char variable :&amp;nbsp; &amp;nbsp;82.04&amp;nbsp; &amp;nbsp;and 108498.19&lt;/P&gt;
&lt;P&gt;I would like to convert these values into numeric&lt;/P&gt;
&lt;P&gt;I saw that there are multiple solutions.&lt;/P&gt;
&lt;P&gt;Numeric=INPUT(char, COMMA10.2);&lt;/P&gt;
&lt;P&gt;Numeric=INPUT(char, COMMA32.);&lt;/P&gt;
&lt;P&gt;Numeric=INPUT(char, COMMA15.);&lt;/P&gt;
&lt;P&gt;My question is why there are multiple informats that can be used in this case???&lt;/P&gt;
&lt;P&gt;Is there not only one correct informat?&lt;/P&gt;
&lt;P&gt;I also want to understand please what is the correct informat in this example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;
&lt;P&gt;Joe&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2020 12:08:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-char-to-numeric-and-recognize-correct-informat/m-p/633552#M187938</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-03-20T12:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: convert char to numeric and recognize correct informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-char-to-numeric-and-recognize-correct-informat/m-p/633554#M187939</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;d
specifies the powerof 10 by which to divide the value. If the data contain decimal points,the d value is ignored. This argument is optional. 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Mar 2020 12:16:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-char-to-numeric-and-recognize-correct-informat/m-p/633554#M187939</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2020-03-20T12:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: convert char to numeric and recognize correct informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-char-to-numeric-and-recognize-correct-informat/m-p/633558#M187942</link>
      <description>I don't understand. Can  you try to explain it again please?&lt;BR /&gt;char value  123,456.78    has decimal point.&lt;BR /&gt;what should be the informat?&lt;BR /&gt;Is it possible that there are multiple informats that can be used in this example?</description>
      <pubDate>Fri, 20 Mar 2020 12:21:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-char-to-numeric-and-recognize-correct-informat/m-p/633558#M187942</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-03-20T12:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: convert char to numeric and recognize correct informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-char-to-numeric-and-recognize-correct-informat/m-p/633559#M187943</link>
      <description>Is it possible to use informat  BEST32.  for any case????&lt;BR /&gt;When will we use informat BEST32. ?</description>
      <pubDate>Fri, 20 Mar 2020 12:24:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-char-to-numeric-and-recognize-correct-informat/m-p/633559#M187943</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-03-20T12:24:15Z</dc:date>
    </item>
    <item>
      <title>Re: convert char to numeric and recognize correct informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-char-to-numeric-and-recognize-correct-informat/m-p/633562#M187945</link>
      <description>If you use BEST32 as an INformat it is just a alias for the normal 32. informat.</description>
      <pubDate>Fri, 20 Mar 2020 12:35:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-char-to-numeric-and-recognize-correct-informat/m-p/633562#M187945</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-20T12:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: convert char to numeric and recognize correct informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-char-to-numeric-and-recognize-correct-informat/m-p/633563#M187946</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I don't understand. Can you try to explain it again please?&lt;BR /&gt;char value 123,456.78 has decimal point.&lt;BR /&gt;what should be the informat?&lt;BR /&gt;Is it possible that there are multiple informats that can be used in this example?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Only include a number of decimal places on the INFORMAT if you want SAS to imply where the decimal point should be when the string being read does NOT contain one.&amp;nbsp; So with 32.2 as the INFORMAT the string '1234567' will become the number 12,345.67.&amp;nbsp; But if the string has a decimal point the number of decimal places listed in the informat is ignored.&amp;nbsp; So a string like '1234.567' becomes the number 1,234.567&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2020 14:21:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-char-to-numeric-and-recognize-correct-informat/m-p/633563#M187946</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-20T14:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: convert char to numeric and recognize correct informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-char-to-numeric-and-recognize-correct-informat/m-p/633565#M187948</link>
      <description>COMMA32 in some ways is the "best" informat.  It will ignore commas and dollar signs.  But note that means it is happy to convert strings like '12,34,56$78' that a human would consider invalid to the number 12,345,678.</description>
      <pubDate>Fri, 20 Mar 2020 12:42:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-char-to-numeric-and-recognize-correct-informat/m-p/633565#M187948</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-20T12:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: convert char to numeric and recognize correct informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-char-to-numeric-and-recognize-correct-informat/m-p/633571#M187949</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;In char value&amp;nbsp;108498.19&amp;nbsp; there are 2 number after decimal point.&lt;/P&gt;
&lt;P&gt;What is the correct informat here?&lt;/P&gt;
&lt;P&gt;Is it important to see how many number in right side of decimal point?&lt;/P&gt;
&lt;P&gt;Can you explain please. I still not understand&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2020 12:51:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-char-to-numeric-and-recognize-correct-informat/m-p/633571#M187949</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-03-20T12:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: convert char to numeric and recognize correct informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-char-to-numeric-and-recognize-correct-informat/m-p/633577#M187950</link>
      <description>You do not have to tell SAS how to recognize the decimal point.  Just use a width that is long enough not to ignore the last three characters.&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Mar 2020 13:27:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-char-to-numeric-and-recognize-correct-informat/m-p/633577#M187950</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-20T13:27:05Z</dc:date>
    </item>
  </channel>
</rss>

