<?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 a character values with comma to numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732540#M228266</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are absolutely right!&lt;/P&gt;
&lt;P&gt;I was misled by the data step generated by proc import. It sometimes uses best32. as an INformat.&lt;/P&gt;
&lt;P&gt;For&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286185"&gt;@SASdevAnneMarie&lt;/a&gt;&amp;nbsp;something like&amp;nbsp;nlnum32. would also work as an informat (even when commas are there).&lt;/P&gt;
&lt;P&gt;And nlnum32. is more "generic" than commax10.1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&amp;nbsp;for putting the finishing touches to this.&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
    <pubDate>Fri, 09 Apr 2021 16:19:08 GMT</pubDate>
    <dc:creator>sbxkoenk</dc:creator>
    <dc:date>2021-04-09T16:19:08Z</dc:date>
    <item>
      <title>Convert a character values with comma to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732516#M228249</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you know please how to convert this column to numeric without passing by "substr" function ?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MarieT_1-1617980493798.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/57231i76A9E85B49DF44EF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MarieT_1-1617980493798.png" alt="MarieT_1-1617980493798.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for help !&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 15:03:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732516#M228249</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2021-04-09T15:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a character values with comma to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732517#M228250</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
 CommaNumberChar = '76087,8';
run;
data want;
 set have;
 Number=input(CommaNumberChar, commax10.1);
run;
/* end of program */&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Apr 2021 15:07:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732517#M228250</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-04-09T15:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a character values with comma to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732518#M228251</link>
      <description>&lt;P&gt;On top of my previous response ...&lt;/P&gt;
&lt;P&gt;It's better to provide us with your data by using a data-step with datalines (cards) statement instead of a screenshot. We can immediately use these data then by copying / pasting in our own SAS session.&lt;/P&gt;
&lt;P&gt;Important: If you copy / paste your SAS program in your question-entry, be sure to use the 'Insert SAS Code' icon. That way structure and formatting is preserved and some useful highlighting and coloring is done on the statements.&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 15:12:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732518#M228251</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-04-09T15:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a character values with comma to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732519#M228252</link>
      <description>&lt;P&gt;Or use the bestw. informat (best12., best32., ...).&lt;/P&gt;
&lt;P&gt;Good luck,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 15:17:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732519#M228252</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-04-09T15:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a character values with comma to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732520#M228253</link>
      <description>Thank you !&lt;BR /&gt;Do you know please the monetary format like 22,5 € ? I can't find it.</description>
      <pubDate>Fri, 09 Apr 2021 15:17:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732520#M228253</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2021-04-09T15:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a character values with comma to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732521#M228254</link>
      <description>Thank you, Koen, I noted ! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Fri, 09 Apr 2021 15:17:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732521#M228254</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2021-04-09T15:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a character values with comma to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732523#M228256</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Sorry, the BESTw. informat does not work for numbers with commas (when the numbers have the character data type).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On the topic of:&amp;nbsp;&lt;SPAN&gt;format like 22,5 €&amp;nbsp;?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;It's the&amp;nbsp;EUROw.d Format or the&amp;nbsp;EUROXw.d Format (with commas).&lt;/P&gt;
&lt;PRE&gt;data have;&lt;BR /&gt; CommaNumberChar = '11111,22';&lt;BR /&gt;run;&lt;BR /&gt;data want;&lt;BR /&gt; set have;&lt;BR /&gt; Number1=input(CommaNumberChar, commax12.2);&lt;BR /&gt; Number2=Number1;&lt;BR /&gt; format Number1 EURO12.2;&lt;BR /&gt; format Number2 EUROX12.2;&lt;BR /&gt;run;&lt;BR /&gt;/* end of program */&lt;/PRE&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 15:25:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732523#M228256</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-04-09T15:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a character values with comma to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732525#M228257</link>
      <description>Thank you very much Koen !</description>
      <pubDate>Fri, 09 Apr 2021 15:33:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732525#M228257</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2021-04-09T15:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a character values with comma to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732535#M228264</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/60547"&gt;@sbxkoenk&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Or use the bestw. informat (best12., best32., ...).&lt;/P&gt;
&lt;P&gt;Good luck,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Note that there is not really a BEST informat.&amp;nbsp; There is a BEST format.&lt;/P&gt;
&lt;P&gt;If you use BEST as in informat then SAS will just use the regular numeric informat.&amp;nbsp; So writing BEST12. informat is just a longer (more confusing) way of asking for the 12. informat&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In any case this will not normally support of using comma as the decimal separator instead of period.&amp;nbsp; You probably need use on of the informats with X at the end.&amp;nbsp; Like COMMA or COMMAX. or NLNUM or NLNUMI.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/api/docsets/nlsref/1.0/content/nlsref.pdf?locale=en" target="_blank" rel="noopener"&gt;https://documentation.sas.com/api/docsets/nlsref/1.0/content/nlsref.pdf?locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 16:13:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732535#M228264</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-04-09T16:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a character values with comma to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732540#M228266</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are absolutely right!&lt;/P&gt;
&lt;P&gt;I was misled by the data step generated by proc import. It sometimes uses best32. as an INformat.&lt;/P&gt;
&lt;P&gt;For&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286185"&gt;@SASdevAnneMarie&lt;/a&gt;&amp;nbsp;something like&amp;nbsp;nlnum32. would also work as an informat (even when commas are there).&lt;/P&gt;
&lt;P&gt;And nlnum32. is more "generic" than commax10.1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&amp;nbsp;for putting the finishing touches to this.&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 16:19:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732540#M228266</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-04-09T16:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a character values with comma to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732549#M228273</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/60547"&gt;@sbxkoenk&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are absolutely right!&lt;/P&gt;
&lt;P&gt;I was misled by the data step generated by proc import. It sometimes uses best32. as an INformat.&lt;/P&gt;
&lt;P&gt;For&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286185"&gt;@SASdevAnneMarie&lt;/a&gt;&amp;nbsp;something like&amp;nbsp;nlnum32. would also work as an informat (even when commas are there).&lt;/P&gt;
&lt;P&gt;And nlnum32. is more "generic" than commax10.1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&amp;nbsp;for putting the finishing touches to this.&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I only use the code generated by PROC IMPORT to get an idea of how it guessed to defined the variables (type and length) and to see if any variables have informats or formats that are needed (like DATE or MMDDYY).&amp;nbsp; In general many tools like that which need to generate code will produce code that is too verbose.&amp;nbsp; &amp;nbsp;But I am not sure why PROC IMPORT is writing code that is using the side effect of attaching an INFORMAT to the variable as the first place the variable appears to force SAS to define the type and length of the variables.&amp;nbsp; It should just generate a LENGTH or ATTRIB statement.&amp;nbsp; Then it would only need to attach informats to the variables that need them (which is not many).&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 16:28:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732549#M228273</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-04-09T16:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Convert a character values with comma to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732691#M228335</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
 CommaNumberChar = '76087,8';
run;
data want;
 set have;
 Number=input(CommaNumberChar, numx20.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Apr 2021 10:29:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-a-character-values-with-comma-to-numeric/m-p/732691#M228335</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-04-10T10:29:25Z</dc:date>
    </item>
  </channel>
</rss>

