<?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: Remove symbols from a character field and make it numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Remove-symbols-from-a-character-field-and-make-it-numeric/m-p/494537#M130335</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  data have;
 input ID $    AMOUNT $;
 cards;
 A1    +100
 A2     0
 A3     +350
 A4     -200
 ;

 data want;
 set have;
 New_amt=input(compress(amount,'-','kd'),best.);

 run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 11 Sep 2018 16:35:10 GMT</pubDate>
    <dc:creator>rajeshalwayswel</dc:creator>
    <dc:date>2018-09-11T16:35:10Z</dc:date>
    <item>
      <title>Remove symbols from a character field and make it numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-symbols-from-a-character-field-and-make-it-numeric/m-p/494511#M130328</link>
      <description>&lt;P&gt;I have a dataset DST1 which has two columns (ID and AMOUNT) and both are character field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp;AMOUNT&lt;/P&gt;&lt;P&gt;A1&amp;nbsp; &amp;nbsp; +100&lt;/P&gt;&lt;P&gt;A2&amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;&lt;P&gt;A3&amp;nbsp; &amp;nbsp; &amp;nbsp;+350&lt;/P&gt;&lt;P&gt;A4&amp;nbsp; &amp;nbsp; &amp;nbsp;-200&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to convert the Amount column as number and remove the + sign for positive numbers and retain the sign for negative number only. Could you please help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 15:14:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-symbols-from-a-character-field-and-make-it-numeric/m-p/494511#M130328</guid>
      <dc:creator>Jagadeesh2907</dc:creator>
      <dc:date>2018-09-11T15:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: Remove symbols from a character field and make it numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-symbols-from-a-character-field-and-make-it-numeric/m-p/494514#M130330</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID $    AMOUNT $;
cards;
A1    +100
A2     0
A3     +350
A4     -200
;

data want;
set have;
New_amt=input(compress(amount,,'kd'),8.)*sign(amount);
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Sep 2018 15:23:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-symbols-from-a-character-field-and-make-it-numeric/m-p/494514#M130330</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-09-11T15:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: Remove symbols from a character field and make it numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-symbols-from-a-character-field-and-make-it-numeric/m-p/494520#M130331</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID $    AMOUNT $;
cards;
A1    +100
A2     0
A3     +350
A4     -200
;

data want;
set have;
_l=length(amount);
_infmt=cats('bz',_l,'.');
new_amount=inputn(amount,_infmt);
drop _:;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, not confident of this solution though&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 15:51:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-symbols-from-a-character-field-and-make-it-numeric/m-p/494520#M130331</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-09-11T15:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: Remove symbols from a character field and make it numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-symbols-from-a-character-field-and-make-it-numeric/m-p/494537#M130335</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  data have;
 input ID $    AMOUNT $;
 cards;
 A1    +100
 A2     0
 A3     +350
 A4     -200
 ;

 data want;
 set have;
 New_amt=input(compress(amount,'-','kd'),best.);

 run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Sep 2018 16:35:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-symbols-from-a-character-field-and-make-it-numeric/m-p/494537#M130335</guid>
      <dc:creator>rajeshalwayswel</dc:creator>
      <dc:date>2018-09-11T16:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: Remove symbols from a character field and make it numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-symbols-from-a-character-field-and-make-it-numeric/m-p/494538#M130336</link>
      <description>&lt;P&gt;Most simplest:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID $    AMOUNT $;
cards;
A1    +100
A2     0
A3     +350
A4     -200
;

data want;
set have;
new_amt=input(amount,e8.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I only learned e informat just now&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 16:37:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-symbols-from-a-character-field-and-make-it-numeric/m-p/494538#M130336</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-09-11T16:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: Remove symbols from a character field and make it numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-symbols-from-a-character-field-and-make-it-numeric/m-p/494546#M130337</link>
      <description>&lt;P&gt;An existing variable cannot change types. To create a numeric value you will need to create a new variable.&lt;/P&gt;
&lt;P&gt;If you want to use the same name of the variable as the new variable name then modify &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;solution as&lt;/P&gt;
&lt;PRE&gt;data want;
   set have (rename=(amount=oldamount));
   new_amt=input(oldamount,e8.);
   drop oldamount;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Sep 2018 16:57:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-symbols-from-a-character-field-and-make-it-numeric/m-p/494546#M130337</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-09-11T16:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: Remove symbols from a character field and make it numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-symbols-from-a-character-field-and-make-it-numeric/m-p/494852#M130487</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID $    AMOUNT $;
cards;
A1    +100
A2     0
A3     +350
A4     -200
;

data want;
set have;
New_amt=input(amount,best.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Sep 2018 13:43:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-symbols-from-a-character-field-and-make-it-numeric/m-p/494852#M130487</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-09-12T13:43:42Z</dc:date>
    </item>
  </channel>
</rss>

