<?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 string with comma to number in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-string-with-comma-to-number/m-p/752111#M236864</link>
    <description>&lt;P&gt;I have a record with "7,5" is marked as string. When I try&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input("7,5", 8.)&amp;nbsp;or&amp;nbsp;input("7,5", best.)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;it returns . or null number. What is the problem here? How could we solve it?&lt;/P&gt;</description>
    <pubDate>Mon, 05 Jul 2021 15:48:44 GMT</pubDate>
    <dc:creator>vietlinh12hoa</dc:creator>
    <dc:date>2021-07-05T15:48:44Z</dc:date>
    <item>
      <title>Convert string with comma to number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-string-with-comma-to-number/m-p/752111#M236864</link>
      <description>&lt;P&gt;I have a record with "7,5" is marked as string. When I try&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input("7,5", 8.)&amp;nbsp;or&amp;nbsp;input("7,5", best.)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;it returns . or null number. What is the problem here? How could we solve it?&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 15:48:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-string-with-comma-to-number/m-p/752111#M236864</guid>
      <dc:creator>vietlinh12hoa</dc:creator>
      <dc:date>2021-07-05T15:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: Convert string with comma to number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-string-with-comma-to-number/m-p/752116#M236866</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/380957"&gt;@vietlinh12hoa&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It can be read with a comma informat:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;input("7,5",comma8.1);&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;But the comma format is very sensitive and makes factor 10 errors if there are no decimals or a different number of digits after the comma. So it is more secure to translate the comma to a point and use a standard numeric input format:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;input(translate("7,5",'.',','), best.);&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 16:23:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-string-with-comma-to-number/m-p/752116#M236866</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2021-07-05T16:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: Convert string with comma to number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-string-with-comma-to-number/m-p/752121#M236870</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/380957"&gt;@vietlinh12hoa&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you want to separate the numbers or interpret the comma as a decimal?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following might help:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	/* separate the numbers */
	x = input(scan("7,5",1), 8.);
	y = input(scan("7,5",2), best8.);
	
	/* comma in place of decimal point */
	z = input("7,5",numx.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; kind regards,&lt;/P&gt;
&lt;P&gt;Amir.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 16:44:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-string-with-comma-to-number/m-p/752121#M236870</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2021-07-05T16:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: Convert string with comma to number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-string-with-comma-to-number/m-p/752125#M236873</link>
      <description>Many thanks. It works</description>
      <pubDate>Mon, 05 Jul 2021 16:53:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-string-with-comma-to-number/m-p/752125#M236873</guid>
      <dc:creator>vietlinh12hoa</dc:creator>
      <dc:date>2021-07-05T16:53:31Z</dc:date>
    </item>
  </channel>
</rss>

