<?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: Conversion of character to numeric variable in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Conversion-of-character-to-numeric-variable-in-SAS/m-p/458020#M284487</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input age $;
cards;
12
15
43
;

data want;
set have ;
newage=input(age,8.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 27 Apr 2018 04:51:55 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-04-27T04:51:55Z</dc:date>
    <item>
      <title>Conversion of character to numeric variable in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conversion-of-character-to-numeric-variable-in-SAS/m-p/458019#M284486</link>
      <description>&lt;P&gt;I am trying to convert a character variable to numeric&lt;/P&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-forum-message-main"&gt;&lt;DIV class="lia-quilt-column lia-quilt-column-20 lia-quilt-column-right lia-quilt-column-main-right"&gt;&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-right"&gt;&lt;DIV class="lia-message-body"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a column of data with the following attributes:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Set Name: woleaim1&lt;/P&gt;&lt;P&gt;Variable: age&lt;/P&gt;&lt;P&gt;Type: Char&lt;/P&gt;&lt;P&gt;Len: 3&lt;/P&gt;&lt;P&gt;Format: $3.&lt;/P&gt;&lt;P&gt;Informat: $3.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These data are formatted as character and I want to convert it to numeric. I tried the following command&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data woleaim1;&lt;BR /&gt;age_num = input(age, $3.);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;This is the error message below:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).&lt;BR /&gt;588:23&lt;BR /&gt;NOTE: Variable age is uninitialized.&lt;BR /&gt;NOTE: The data set WORK.WOLEAIM1 has 1 observations and 2 variables.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Thanks!&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 27 Apr 2018 04:47:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conversion-of-character-to-numeric-variable-in-SAS/m-p/458019#M284486</guid>
      <dc:creator>oab</dc:creator>
      <dc:date>2018-04-27T04:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion of character to numeric variable in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conversion-of-character-to-numeric-variable-in-SAS/m-p/458020#M284487</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input age $;
cards;
12
15
43
;

data want;
set have ;
newage=input(age,8.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Apr 2018 04:51:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conversion-of-character-to-numeric-variable-in-SAS/m-p/458020#M284487</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-04-27T04:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion of character to numeric variable in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conversion-of-character-to-numeric-variable-in-SAS/m-p/458021#M284488</link>
      <description>Thank you. It worked!</description>
      <pubDate>Fri, 27 Apr 2018 04:59:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conversion-of-character-to-numeric-variable-in-SAS/m-p/458021#M284488</guid>
      <dc:creator>oab</dc:creator>
      <dc:date>2018-04-27T04:59:05Z</dc:date>
    </item>
  </channel>
</rss>

