<?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: Which format do I need if I have some numbers with commas? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Which-format-do-I-need-if-I-have-some-numbers-with-commas/m-p/104079#M29090</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is the comma supposed to be a decimal, french notation?&lt;/P&gt;&lt;P&gt;If so could you use the translate function to get it to be a period and then read in as a standard number?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Apr 2013 14:42:08 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2013-04-10T14:42:08Z</dc:date>
    <item>
      <title>Which format do I need if I have some numbers with commas?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Which-format-do-I-need-if-I-have-some-numbers-with-commas/m-p/104077#M29088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have lots of numbers to infile - some of them have commas in it, some don't. Also, they don't have the same length.&lt;BR /&gt;For example:&lt;/P&gt;&lt;P&gt;x = 227&lt;/P&gt;&lt;P&gt;y = 99&lt;/P&gt;&lt;P&gt;z = 1033,97&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I try to use stuff like this:&lt;/P&gt;&lt;P&gt;price = input(scan(_infile_,21,'3B'x,'m'),5.2);&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;price = input(scan(_infile_,21,'3B'x,'m'),comma5.2);&lt;/P&gt;&lt;P&gt;then usually it results in:&lt;/P&gt;&lt;P&gt;x = 2.27&lt;/P&gt;&lt;P&gt;y = 0.99&lt;/P&gt;&lt;P&gt;z = 1033.97&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I take &lt;/P&gt;&lt;P&gt;price = input(scan(_infile_,21,'3B'x,'m'),best.);&lt;/P&gt;&lt;P&gt;price = input(scan(_infile_,21,'3B'x,'m'),5.);&lt;/P&gt;&lt;P&gt;x and y are fine, but the .97 of z is missing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I really read a lot but still couldn't find a real solution yet.&lt;/P&gt;&lt;P&gt;I'm sure there is a better way than this:&lt;/P&gt;&lt;P&gt;price= upcase(compbl(scan(_infile_,21,'3B'x,'m')));&lt;/P&gt;&lt;P&gt;price1= scan(price,1, ',' )&lt;/P&gt;&lt;P&gt;price2 = scan(price,2, ',' )&lt;/P&gt;&lt;P&gt;price3 = 0||'.'||price2&lt;/P&gt;&lt;P&gt;price = price1+price3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If just somebody could tell me?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Apr 2013 14:29:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Which-format-do-I-need-if-I-have-some-numbers-with-commas/m-p/104077#M29088</guid>
      <dc:creator>Marian_2127</dc:creator>
      <dc:date>2013-04-10T14:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: Which format do I need if I have some numbers with commas?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Which-format-do-I-need-if-I-have-some-numbers-with-commas/m-p/104078#M29089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;comma.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Apr 2013 14:39:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Which-format-do-I-need-if-I-have-some-numbers-with-commas/m-p/104078#M29089</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2013-04-10T14:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: Which format do I need if I have some numbers with commas?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Which-format-do-I-need-if-I-have-some-numbers-with-commas/m-p/104079#M29090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is the comma supposed to be a decimal, french notation?&lt;/P&gt;&lt;P&gt;If so could you use the translate function to get it to be a period and then read in as a standard number?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Apr 2013 14:42:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Which-format-do-I-need-if-I-have-some-numbers-with-commas/m-p/104079#M29090</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-04-10T14:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: Which format do I need if I have some numbers with commas?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Which-format-do-I-need-if-I-have-some-numbers-with-commas/m-p/104080#M29091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmmm ... I'm not sure you matched up the example 100%.&amp;nbsp; If you tried reading 1033.97 with a comma5.2 informat, you should have gotten 1033.9.&amp;nbsp; At any rate, let's start with the rules.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the data you are reading contains 3 characters, you can still use a comma5. informat.&amp;nbsp; Your informat is allowed to be wider than the number of incoming characters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The comma family of informats is correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't add .2 at the end of the informat.&amp;nbsp; As you have seen by getting 0.99, .2 is an instruction that says, "See if the incoming string contains a decimal point.&amp;nbsp; If it does, use it.&amp;nbsp; But if there is no decimal point, assume that the last two digits read belong after the decimal point."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The bottom line is that you need to find the largest number of characters you will need to read.&amp;nbsp; That number of characters includes everything (decimal point, negative sign, digits before as well as digits after the decimal point).&amp;nbsp; If it is 8, for example, use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;price = input(scan(_infile_, 21, '3B'x, 'm'), comma8.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Apr 2013 14:50:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Which-format-do-I-need-if-I-have-some-numbers-with-commas/m-p/104080#M29091</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-04-10T14:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: Which format do I need if I have some numbers with commas?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Which-format-do-I-need-if-I-have-some-numbers-with-commas/m-p/104081#M29092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@LinusH: That's not working. &lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;P&gt;@Reeza: The comma is supposed to be a decimal, german notation, yes &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;BR /&gt;I think your suggestion might work but it seems still a little like 'MacGyvering'. I'm sure there is a more official way....&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;P&gt;@Astounding: Of course you are right and the 1033.97 would have been a 1033.9 with a comma5.2.&lt;/P&gt;&lt;P&gt;About your idea: Unfortunately, using comma8. doesn't work either as my numbers don't contain a decimal point but a decimal comma.&lt;/P&gt;&lt;P&gt;So the 1033.97 becomes a 103397.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Still thankful for any further ideas &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Apr 2013 06:58:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Which-format-do-I-need-if-I-have-some-numbers-with-commas/m-p/104081#M29092</guid>
      <dc:creator>Marian_2127</dc:creator>
      <dc:date>2013-04-11T06:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: Which format do I need if I have some numbers with commas?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Which-format-do-I-need-if-I-have-some-numbers-with-commas/m-p/104082#M29093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, &lt;EM&gt;numx.&lt;/EM&gt; should do the work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Apr 2013 09:12:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Which-format-do-I-need-if-I-have-some-numbers-with-commas/m-p/104082#M29093</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2013-04-11T09:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: Which format do I need if I have some numbers with commas?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Which-format-do-I-need-if-I-have-some-numbers-with-commas/m-p/104083#M29094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Perfect! Thanks a lot!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Apr 2013 09:22:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Which-format-do-I-need-if-I-have-some-numbers-with-commas/m-p/104083#M29094</guid>
      <dc:creator>Marian_2127</dc:creator>
      <dc:date>2013-04-11T09:22:08Z</dc:date>
    </item>
  </channel>
</rss>

