<?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 large number in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-large-number/m-p/581332#M165217</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/285274"&gt;@1477979&lt;/a&gt;&amp;nbsp;&amp;nbsp;have a rounding issue where using best32. may not be the best format for your large numbers.&lt;/P&gt;
&lt;P&gt;This link may have a format the fits your needs.&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001263753.htm" target="_blank" rel="noopener"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001263753.htm&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Aug 2019 01:54:04 GMT</pubDate>
    <dc:creator>VDD</dc:creator>
    <dc:date>2019-08-15T01:54:04Z</dc:date>
    <item>
      <title>Convert large number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-large-number/m-p/581328#M165213</link>
      <description>&lt;P&gt;Hi, i have a dataset where the numbers are stored as string and i want to perform some calculations to the numbers and convert it back into string. The result i got is wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data b;&lt;BR /&gt;x='9458669011700000';&lt;BR /&gt;y=input(x,best32.) + 7783;&lt;BR /&gt;z=put(y,16.);&lt;/P&gt;&lt;P&gt;put y= best32.;&lt;BR /&gt;keep x y z;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Current Result&lt;/P&gt;&lt;P&gt;z =&amp;nbsp;9458669011707784&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expected result&lt;/P&gt;&lt;P&gt;Z =9458669011707783&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 01:24:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-large-number/m-p/581328#M165213</guid>
      <dc:creator>1477979</dc:creator>
      <dc:date>2019-08-15T01:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: Convert large number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-large-number/m-p/581332#M165217</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/285274"&gt;@1477979&lt;/a&gt;&amp;nbsp;&amp;nbsp;have a rounding issue where using best32. may not be the best format for your large numbers.&lt;/P&gt;
&lt;P&gt;This link may have a format the fits your needs.&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001263753.htm" target="_blank" rel="noopener"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001263753.htm&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 01:54:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-large-number/m-p/581332#M165217</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-08-15T01:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Convert large number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-large-number/m-p/581333#M165218</link>
      <description>&lt;P&gt;SAS stores numbers in 8 bytes which is sufficient for 15 digits to be accurate. 16 digits can't be held accurately. You could consider splitting your number into 2 components, add the number then put the components back together.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 01:53:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-large-number/m-p/581333#M165218</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-08-15T01:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: Convert large number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-large-number/m-p/581335#M165219</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/285274"&gt;@1477979&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As others already explained SAS datasets store numeric variables with 8 bytes and though you loose precision with 16 digits or more.&lt;/P&gt;
&lt;P&gt;However SAS DS2 (Proc DS2) and Proc FedSQL allow for using other datatypes with higher precision. You just need to convert the result back to a string for storing the result with full precision in a SAS table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below a sample using Proc FedSQL.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
  x='9458669011700000';
  output;
  stop;
run;

proc datasets lib=work nolist nowarn;
  delete want;
  run;
quit;
proc fedsql;
  create table want as
  select x, cast(cast(x as bigint) + 7783 as char(16)) as z
  from have
  ;
quit;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 299px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31765i750F8D8FED8BE080/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 03:09:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-large-number/m-p/581335#M165219</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-08-15T03:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: Convert large number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-large-number/m-p/581350#M165224</link>
      <description>&lt;P&gt;Thanks alll!!!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 06:45:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-large-number/m-p/581350#M165224</guid>
      <dc:creator>1477979</dc:creator>
      <dc:date>2019-08-15T06:45:02Z</dc:date>
    </item>
  </channel>
</rss>

