<?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 in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Convert-character-to-numeric/m-p/453309#M13993</link>
    <description>&lt;P&gt;No it hasn't in the sample you provided, below is my test and log&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Calving_ease $;
datalines;
1 
2
3
1
1
2
NA
2
NA
5
2
4
NA
NA
1
2
2
1
;

data want;
set have;
if anyalpha(calving_ease)&amp;gt;0 then call missing(calving_ease);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;436&lt;BR /&gt;437 data have;&lt;BR /&gt;438 input Calving_ease $;&lt;BR /&gt;439 datalines;&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.HAVE has 18 observations and 1 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.02 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;458 ;&lt;BR /&gt;459&lt;BR /&gt;460 data want;&lt;BR /&gt;461 set have;&lt;BR /&gt;462 if anyalpha(calving_ease) then call missing(calving_ease);&lt;BR /&gt;463 run;&lt;/P&gt;&lt;P&gt;NOTE: There were 18 observations read from the data set WORK.HAVE.&lt;BR /&gt;NOTE: The data set WORK.WANT has 18 observations and 1 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.02 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 11 Apr 2018 17:33:47 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-04-11T17:33:47Z</dc:date>
    <item>
      <title>Convert character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Convert-character-to-numeric/m-p/453299#M13988</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Calving_ease
1 
2
3
1
1
2
NA
2
NA
5
2
4
NA
NA
1
2
2
1&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I would like to convert this variable records(CHARACTERS) to missing data instead&amp;nbsp;of NA.&amp;nbsp; as well as I want to keep the same variable name(Calving_ease) in my original&amp;nbsp;dataset (MFD4)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 17:17:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Convert-character-to-numeric/m-p/453299#M13988</guid>
      <dc:creator>Barkamih</dc:creator>
      <dc:date>2018-04-11T17:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: Convert character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Convert-character-to-numeric/m-p/453303#M13989</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if anyalpha(calving_ease)&amp;gt;0 then call missing(calving_ease);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Apr 2018 17:34:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Convert-character-to-numeric/m-p/453303#M13989</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-04-11T17:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: Convert character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Convert-character-to-numeric/m-p/453305#M13990</link>
      <description>Just input(), invalid numerical data will be missing automatically.</description>
      <pubDate>Wed, 11 Apr 2018 17:22:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Convert-character-to-numeric/m-p/453305#M13990</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-04-11T17:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: Convert character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Convert-character-to-numeric/m-p/453307#M13991</link>
      <description>&lt;P&gt;I agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp;however you may need to add a &lt;STRONG&gt;??&lt;/STRONG&gt; modifier to prevent sas from writing&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;NOTE: Invalid data for Calving_ease in line . &lt;/STRONG&gt;&lt;/EM&gt;messages in the log&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 17:26:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Convert-character-to-numeric/m-p/453307#M13991</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-04-11T17:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Convert character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Convert-character-to-numeric/m-p/453308#M13992</link>
      <description>&lt;P&gt;this code has deleted the numeric numbers as well !!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 17:26:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Convert-character-to-numeric/m-p/453308#M13992</guid>
      <dc:creator>Barkamih</dc:creator>
      <dc:date>2018-04-11T17:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: Convert character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Convert-character-to-numeric/m-p/453309#M13993</link>
      <description>&lt;P&gt;No it hasn't in the sample you provided, below is my test and log&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Calving_ease $;
datalines;
1 
2
3
1
1
2
NA
2
NA
5
2
4
NA
NA
1
2
2
1
;

data want;
set have;
if anyalpha(calving_ease)&amp;gt;0 then call missing(calving_ease);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;436&lt;BR /&gt;437 data have;&lt;BR /&gt;438 input Calving_ease $;&lt;BR /&gt;439 datalines;&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.HAVE has 18 observations and 1 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.02 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;458 ;&lt;BR /&gt;459&lt;BR /&gt;460 data want;&lt;BR /&gt;461 set have;&lt;BR /&gt;462 if anyalpha(calving_ease) then call missing(calving_ease);&lt;BR /&gt;463 run;&lt;/P&gt;&lt;P&gt;NOTE: There were 18 observations read from the data set WORK.HAVE.&lt;BR /&gt;NOTE: The data set WORK.WANT has 18 observations and 1 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.02 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 17:33:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Convert-character-to-numeric/m-p/453309#M13993</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-04-11T17:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: Convert character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Convert-character-to-numeric/m-p/453313#M13994</link>
      <description>&lt;P&gt;To keep the same name, you have to add a little tap dancing:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;tempvar = input(calving_ease, ??8.);&lt;/P&gt;
&lt;P&gt;drop calving_ease;&lt;/P&gt;
&lt;P&gt;rename tempvar = calving_ease;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 17:34:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Convert-character-to-numeric/m-p/453313#M13994</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-11T17:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: Convert character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Convert-character-to-numeric/m-p/453316#M13995</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp;however you may need to add a &lt;STRONG&gt;??&lt;/STRONG&gt; modifier to prevent sas from writing&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;NOTE: Invalid data for Calving_ease in line . &lt;/STRONG&gt;&lt;/EM&gt;messages in the log&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Or use a custom informat to assign a special missing for the N/A values. That way you know&amp;nbsp; the source of the data was specifically marked N/A.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 17:38:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Convert-character-to-numeric/m-p/453316#M13995</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-04-11T17:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: Convert character to numeric</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Convert-character-to-numeric/m-p/453319#M13996</link>
      <description>&lt;P&gt;Compress seems to work too:)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Calving_ease $;
datalines;
1 
2
3
1
1
2
NA
2
NA
5
2
4
NA
NA
1
2
2
1
;
data want;
set have;
calving_ease=compress(calving_ease,,'kd');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Apr 2018 18:01:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Convert-character-to-numeric/m-p/453319#M13996</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-04-11T18:01:02Z</dc:date>
    </item>
  </channel>
</rss>

