<?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 Change Character type to numeric type in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Change-Character-type-to-numeric-type/m-p/883528#M39215</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I have a data where the debt_code is a character ype and format is $24. I want to change the debt_code to numeric. Can you suggest how to do it?&lt;/P&gt;
&lt;P&gt;sample dataset:&lt;/P&gt;
&lt;P&gt;Data Sample;&lt;BR /&gt;infile cards expandtabs;&lt;BR /&gt;input debt_code release_date :date9.;&lt;BR /&gt;format release_date date9.;&lt;BR /&gt;datalines ;&lt;BR /&gt;394013684 30-Mar-23&lt;BR /&gt;238505887 30-Mar-23&lt;BR /&gt;428101570 30-Mar-23&lt;BR /&gt;428101570 30-Mar-23&lt;BR /&gt;425461019 30-Mar-23&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 05 Jul 2023 10:14:43 GMT</pubDate>
    <dc:creator>Sandeep77</dc:creator>
    <dc:date>2023-07-05T10:14:43Z</dc:date>
    <item>
      <title>Change Character type to numeric type</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-Character-type-to-numeric-type/m-p/883528#M39215</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I have a data where the debt_code is a character ype and format is $24. I want to change the debt_code to numeric. Can you suggest how to do it?&lt;/P&gt;
&lt;P&gt;sample dataset:&lt;/P&gt;
&lt;P&gt;Data Sample;&lt;BR /&gt;infile cards expandtabs;&lt;BR /&gt;input debt_code release_date :date9.;&lt;BR /&gt;format release_date date9.;&lt;BR /&gt;datalines ;&lt;BR /&gt;394013684 30-Mar-23&lt;BR /&gt;238505887 30-Mar-23&lt;BR /&gt;428101570 30-Mar-23&lt;BR /&gt;428101570 30-Mar-23&lt;BR /&gt;425461019 30-Mar-23&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2023 10:14:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-Character-type-to-numeric-type/m-p/883528#M39215</guid>
      <dc:creator>Sandeep77</dc:creator>
      <dc:date>2023-07-05T10:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Change Character type to numeric type</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-Character-type-to-numeric-type/m-p/883553#M39216</link>
      <description>&lt;P&gt;You will have to make a new variable since you want it to have a different type.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use an INPUT() function call to make a number from it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;debt_number = input(debt_code,32.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can use RENAME statement to change the variable names if want.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;rename debt_code=debt_char debt_number=debt_code ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;BUT if the length of the digit strings in DEPT_CODE is longer than 16 then changing it to a number runs the risk of loosing precision.&amp;nbsp; The maximum integer that SAS can store is:&amp;nbsp;9,007,199,254,740,992&lt;/P&gt;
&lt;PRE&gt;188  data _null_;
189    maxint=constant('exactint');
190    put maxint= comma32. ;
191    digits=length(strip(cats(maxint)));
192    put digits=;
193  run;

maxint=9,007,199,254,740,992
digits=16
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2023 12:44:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-Character-type-to-numeric-type/m-p/883553#M39216</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-07-05T12:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: Change Character type to numeric type</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Change-Character-type-to-numeric-type/m-p/883555#M39217</link>
      <description>&lt;P&gt;These may help:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to convert a character value to numeric in SAS&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-convert-a-character-value-to-numeric-in-SAS/ta-p/847645" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-convert-a-character-value-to-numeric-in-SAS/ta-p/847645&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Convert variable values from character to numeric or from numeric to character&amp;nbsp;&lt;A href="https://support.sas.com/kb/24/590.html" target="_blank"&gt;https://support.sas.com/kb/24/590.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2023 12:44:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Change-Character-type-to-numeric-type/m-p/883555#M39217</guid>
      <dc:creator>SAS_Cares</dc:creator>
      <dc:date>2023-07-05T12:44:54Z</dc:date>
    </item>
  </channel>
</rss>

