<?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: Converting long number to character in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Converting-long-number-to-character/m-p/542120#M7486</link>
    <description>&lt;P&gt;When did these values get turned into numeric values in SAS?&lt;/P&gt;
&lt;P&gt;Likely culprits are incorrect reading of external files, proc import a possible candidate.&lt;/P&gt;
&lt;P&gt;The original values should have been read and kept as character.&lt;/P&gt;
&lt;P&gt;The precision in SAS is such that anything with more than 16 digits is very problematic as to whether they are stored correctly.&lt;/P&gt;
&lt;P&gt;The largest value for an 8-bytel numeric is&lt;/P&gt;
&lt;P&gt;9,007,199,254,740,992 which is 16 digits. Anything larger is problematic for correct storage and display&lt;/P&gt;
&lt;PRE&gt;data example;
x=11111111111111111;
put x comma23.;
run; &lt;/PRE&gt;
&lt;P&gt;You best bet may be to go back in your process and ensure the value never gets treated as numeric at all. Once the conversion has been made the initial values may be corrupt.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Controlling variable types and lengths generally means reading from a text file with a character informat as long as the longest expected value.&lt;/P&gt;
&lt;P&gt;Or if the value came from a database with longer integer values then create a version on the database case to character of appropriate length before reading with SAs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Mar 2019 17:07:57 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-03-11T17:07:57Z</dc:date>
    <item>
      <title>Converting long number to character</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-long-number-to-character/m-p/541942#M7440</link>
      <description>&lt;P&gt;I am having an issue with converting a long numeric value (gt 16 dgitis) to a character variable without losing info.&lt;/P&gt;&lt;P&gt;The issue I am having is when exporting to excel I the value gets replaced with 0's at the end&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2019 10:50:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-long-number-to-character/m-p/541942#M7440</guid>
      <dc:creator>lm12abh</dc:creator>
      <dc:date>2019-03-11T10:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: Converting long number to character</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-long-number-to-character/m-p/541964#M7448</link>
      <description>&lt;P&gt;Such long numbers are usually not numbers as such, but some kind of key. Keep them as character.&lt;/P&gt;
&lt;P&gt;SAS provides precision up to 15 decimal digits (because of the 8 byte real format used for number storage).&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2019 11:33:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-long-number-to-character/m-p/541964#M7448</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-03-11T11:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: Converting long number to character</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-long-number-to-character/m-p/542120#M7486</link>
      <description>&lt;P&gt;When did these values get turned into numeric values in SAS?&lt;/P&gt;
&lt;P&gt;Likely culprits are incorrect reading of external files, proc import a possible candidate.&lt;/P&gt;
&lt;P&gt;The original values should have been read and kept as character.&lt;/P&gt;
&lt;P&gt;The precision in SAS is such that anything with more than 16 digits is very problematic as to whether they are stored correctly.&lt;/P&gt;
&lt;P&gt;The largest value for an 8-bytel numeric is&lt;/P&gt;
&lt;P&gt;9,007,199,254,740,992 which is 16 digits. Anything larger is problematic for correct storage and display&lt;/P&gt;
&lt;PRE&gt;data example;
x=11111111111111111;
put x comma23.;
run; &lt;/PRE&gt;
&lt;P&gt;You best bet may be to go back in your process and ensure the value never gets treated as numeric at all. Once the conversion has been made the initial values may be corrupt.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Controlling variable types and lengths generally means reading from a text file with a character informat as long as the longest expected value.&lt;/P&gt;
&lt;P&gt;Or if the value came from a database with longer integer values then create a version on the database case to character of appropriate length before reading with SAs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2019 17:07:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-long-number-to-character/m-p/542120#M7486</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-03-11T17:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: Converting long number to character</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-long-number-to-character/m-p/542288#M7527</link>
      <description>&lt;P&gt;Thanks for this. The value is numerical from the source data and is either 13 or 16 digits. The issue occurs when I export the data to excel,&amp;nbsp;the last 2 digits get replaced with trailing 0's. I need to keep all the information in excel and thus need to convert this to a string but I am having trouble doing this. Example:&lt;/P&gt;&lt;P&gt;Number&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Desired string&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; obtained string&lt;/P&gt;&lt;P&gt;1234567891234567&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1234567891234567&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1234567891234500&lt;/P&gt;&lt;P&gt;How do I get my desired string.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 08:17:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-long-number-to-character/m-p/542288#M7527</guid>
      <dc:creator>lm12abh</dc:creator>
      <dc:date>2019-03-12T08:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: Converting long number to character</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Converting-long-number-to-character/m-p/542560#M7573</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/266053"&gt;@lm12abh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for this. The value is numerical from the source data and is either 13 or 16 digits. The issue occurs when I export the data to excel,&amp;nbsp;the last 2 digits get replaced with trailing 0's. I need to keep all the information in excel and thus need to convert this to a string but I am having trouble doing this. Example:&lt;/P&gt;
&lt;P&gt;Number&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Desired string&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; obtained string&lt;/P&gt;
&lt;P&gt;1234567891234567&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1234567891234567&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1234567891234500&lt;/P&gt;
&lt;P&gt;How do I get my desired string.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You might show exactly how your are getting the values into Excel.&lt;/P&gt;
&lt;P&gt;Also check your Excel cell properties to see if display has been set to round or truncate values. Excel is known to set properties that you didn't expect.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 20:06:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Converting-long-number-to-character/m-p/542560#M7573</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-03-12T20:06:08Z</dc:date>
    </item>
  </channel>
</rss>

