| 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 |
|
| In-Reply-To: | <976042.72962.qm@web51904.mail.re2.yahoo.com> |
| 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
be).
See http://support.sas.com/techsup/technote/ts654.pdf for more information.
-Joe
On Fri, Sep 17, 2010 at 7:31 AM, Muhammad Khan <muhammadzkhan@yahoo.com>wrote:
> i'm trying to read a numeric number
>
> 2000123007201476211
>
> data l;
> format a 20.;
> input a ;
> cards;
> 2000123007201476211
> ;
> run;
>
> proc print data = l;
> run;
>
> the print produces
>
> 2000123007201476096
>
> The last 3 digits changes from 211 to 096.
>
> I would like to create a sas dataset with the original value.
>
> Any thoughts?
>
> TIA
>
|