|Date: ||Fri, 17 Sep 2010 08:37:33 -0500|
|Reply-To: ||Joe Matise <snoopy369@GMAIL.COM>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||Joe Matise <snoopy369@GMAIL.COM>|
|Subject: ||Re: reading numeric|
|Content-Type: ||text/plain; charset=ISO-8859-1|
You can only store a full precision number up to 2^52, if I remember
correctly; there are 64 bits to an 8 byte number, and 52 are used to store
precision, 1 to store sign, and 11 to store the exponent, on an IEEE
(Windows, OS/2, Unix) machine. Other machines have slightly different
values here. If you attempt to store a number higher than 2^52, it will
store it as a floating point number, so that number is something like
2.000123007201476 * 10^20 rather than 2000123007201476211.
The only solution to this that maintains your precision is either to split
the number up (say, if all of your numbers start with 200012... then remove
that portion and put it in a second variable) or to store it as a string
(character variable). In general, 15 digits is completely safe and 16 is
not (some 16 digit numbers will be stored at full precision, some will not
See http://support.sas.com/techsup/technote/ts654.pdf for more information.
On Fri, Sep 17, 2010 at 7:31 AM, Muhammad Khan <firstname.lastname@example.org>wrote:
> i'm trying to read a numeric number
> data l;
> format a 20.;
> input a ;
> proc print data = l;
> the print produces
> The last 3 digits changes from 211 to 096.
> I would like to create a sas dataset with the original value.
> Any thoughts?