<?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 character to numeric $1,000.32 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-character-to-numeric-1-000-32/m-p/396724#M95810</link>
    <description>&lt;P&gt;Try this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WANT;
  set HAVE;
 var1_new=input(compress(var1,"$,"),8.);
 var2_new=input(compress(var2,"$,"),8.);
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;</description>
    <pubDate>Mon, 18 Sep 2017 04:48:10 GMT</pubDate>
    <dc:creator>ShiroAmada</dc:creator>
    <dc:date>2017-09-18T04:48:10Z</dc:date>
    <item>
      <title>Convert character to numeric $1,000.32</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-character-to-numeric-1-000-32/m-p/396723#M95809</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am dealing with a quite messy data and I want to convert them into numeric.&lt;/P&gt;
&lt;P&gt;in the same variable, I have value of say: $90 , $90.25 , 90.28, 1,012 , $1,253.25&lt;/P&gt;
&lt;P&gt;I mean, any combination among $ and comma (,)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My approach is to compress "$" and "," and then create new variable but clearly, it doesn't work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please, any help is very much appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HC&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;&lt;BR /&gt;input var1 $ var2 $;&lt;BR /&gt;datalines;&lt;BR /&gt;$84.12 $1,000.20&lt;BR /&gt;$1,184.12 1,000.20&lt;BR /&gt;84 $55&lt;BR /&gt;;run;&lt;BR /&gt;data have; set have;&lt;BR /&gt; var1=input(compress(var1,'$'),best12.); *I am thinking about an IF var1 contain $ then do, but I dont know how to;&lt;BR /&gt; var1=input(compress(var1,','),best12.);&lt;BR /&gt;&lt;BR /&gt; var2=input(compress(var2,'$'),best12.);&lt;BR /&gt; var2=input(compress(var2,','),best12.);&lt;BR /&gt;run;&lt;BR /&gt;data want; set have;&lt;BR /&gt;drop var1 var2;&lt;BR /&gt; var1_new=Input(var1 ,best12.);&lt;BR /&gt; var2_new=Input(var2 ,best12.);&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2017 03:59:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-character-to-numeric-1-000-32/m-p/396723#M95809</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2017-09-18T03:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: Convert character to numeric $1,000.32</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-character-to-numeric-1-000-32/m-p/396724#M95810</link>
      <description>&lt;P&gt;Try this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WANT;
  set HAVE;
 var1_new=input(compress(var1,"$,"),8.);
 var2_new=input(compress(var2,"$,"),8.);
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2017 04:48:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-character-to-numeric-1-000-32/m-p/396724#M95810</guid>
      <dc:creator>ShiroAmada</dc:creator>
      <dc:date>2017-09-18T04:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: Convert character to numeric $1,000.32</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-character-to-numeric-1-000-32/m-p/396729#M95813</link>
      <description>&lt;P&gt;if you reading the data all you need to do is give informat commaw.d. You can try something like below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
input var1:comma10.2 var2:comma10.2;
datalines;
$84.12 $1,000.20
$1,184.12 1,000.20
84 $55
;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Sep 2017 05:06:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-character-to-numeric-1-000-32/m-p/396729#M95813</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-09-18T05:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: Convert character to numeric $1,000.32</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-character-to-numeric-1-000-32/m-p/396731#M95814</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WANT;
  set HAVE;
  VARN1=input(VAR1,dollar12.); 
  VARN2=input(VAR2,dollar12.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Sep 2017 05:34:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-character-to-numeric-1-000-32/m-p/396731#M95814</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-09-18T05:34:12Z</dc:date>
    </item>
  </channel>
</rss>

