<?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 character data while converting to numeric in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Remove-character-data-while-converting-to-numeric/m-p/48103#M12978</link>
    <description>You can explore using the DATA step function and logic such as: &lt;BR /&gt;
&lt;BR /&gt;
IF ANYALPHA(&lt;VARNAME&gt;) = 0 THEN &lt;YOUR_LOGIC&gt;;&lt;BR /&gt;
&lt;BR /&gt;
For observations with non-numeric values, you will have a SAS MISSING value condition.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;/YOUR_LOGIC&gt;&lt;/VARNAME&gt;</description>
    <pubDate>Tue, 23 Jun 2009 20:06:49 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2009-06-23T20:06:49Z</dc:date>
    <item>
      <title>Remove character data while converting to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-character-data-while-converting-to-numeric/m-p/48102#M12977</link>
      <description>I have a field called customer_id which has field type=character but It has 90,000 numbers and about 100 names. &lt;BR /&gt;
&lt;BR /&gt;
When I convert the field type from character to numeric, it stumbles on the 100 names since they cannot be converted to numeric. I do not care about these names and want to remove them so only numbers will be retained.&lt;BR /&gt;
&lt;BR /&gt;
Code&lt;BR /&gt;
-------&lt;BR /&gt;
data temp (keep = customer_skey customer_id) ;&lt;BR /&gt;
set fdw.customer;&lt;BR /&gt;
customer_id_new=input(customer_id, 8.);&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Error message :  &lt;BR /&gt;
------------------&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Mathematical operations could not be performed at the following places. The results of the operations have been set to  missing values.&lt;BR /&gt;
&lt;BR /&gt;
The problem is that it does NOT create the new field which is numeric, it just gives up. I would like the program to ignore these errors where the data are characters&lt;BR /&gt;
&lt;BR /&gt;
OR&lt;BR /&gt;
&lt;BR /&gt;
I would like to remove the character data so the remaining numbers can easily converted to numeric data types.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Is there a way to purge out all character data from a field and keep only numeric, so the datatype can be converted from character to numeric?</description>
      <pubDate>Tue, 23 Jun 2009 19:29:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-character-data-while-converting-to-numeric/m-p/48102#M12977</guid>
      <dc:creator>osho</dc:creator>
      <dc:date>2009-06-23T19:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: Remove character data while converting to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-character-data-while-converting-to-numeric/m-p/48103#M12978</link>
      <description>You can explore using the DATA step function and logic such as: &lt;BR /&gt;
&lt;BR /&gt;
IF ANYALPHA(&lt;VARNAME&gt;) = 0 THEN &lt;YOUR_LOGIC&gt;;&lt;BR /&gt;
&lt;BR /&gt;
For observations with non-numeric values, you will have a SAS MISSING value condition.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;/YOUR_LOGIC&gt;&lt;/VARNAME&gt;</description>
      <pubDate>Tue, 23 Jun 2009 20:06:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-character-data-while-converting-to-numeric/m-p/48103#M12978</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-06-23T20:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: Remove character data while converting to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-character-data-while-converting-to-numeric/m-p/48104#M12979</link>
      <description>You can eliminate these warnings/errors by using:&lt;BR /&gt;
&lt;BR /&gt;
if input(customer_id, ?? best.) ne . then customer_id_new=input(customer_id, 8.);&lt;BR /&gt;
&lt;BR /&gt;
~ Sukanya E</description>
      <pubDate>Tue, 23 Jun 2009 20:21:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-character-data-while-converting-to-numeric/m-p/48104#M12979</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-06-23T20:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: Remove character data while converting to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-character-data-while-converting-to-numeric/m-p/48105#M12980</link>
      <description>data temp2 ;&lt;BR /&gt;
set temp;&lt;BR /&gt;
customer_id_new ^= .;&lt;BR /&gt;
run;</description>
      <pubDate>Tue, 23 Jun 2009 20:22:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-character-data-while-converting-to-numeric/m-p/48105#M12980</guid>
      <dc:creator>jf</dc:creator>
      <dc:date>2009-06-23T20:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: Remove character data while converting to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-character-data-while-converting-to-numeric/m-p/48106#M12981</link>
      <description>Or,&lt;BR /&gt;
data temp (keep = customer_skey customer_id) ;&lt;BR /&gt;
  set fdw.customer;&lt;BR /&gt;
  if missing(input(customer_id, ??8.)) then delete;&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 24 Jun 2009 16:39:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-character-data-while-converting-to-numeric/m-p/48106#M12981</guid>
      <dc:creator>advoss</dc:creator>
      <dc:date>2009-06-24T16:39:46Z</dc:date>
    </item>
  </channel>
</rss>

