Date: Fri, 24 Sep 2004 13:59:19 -0400
Reply-To: Steve Raimi <steven.raimi@GM.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Steve Raimi <steven.raimi@GM.COM>
Subject: Re: Numeric precision was >> Re: Oracle to SAS - subtle errors in
totals
I don't understand how creating new formats would help me get around this.
Can you explain (or give an example)?
Thanks!
Steve
On Fri, 24 Sep 2004 11:40:53 -0600, Jack Hamilton
<JackHamilton@FIRSTHEALTH.COM> wrote:
>I don't know of any way around the problem. That's why there are
>requests for an integer, fixed-point, or currency numeric type in SAS in
>addition to the floating point numbers now available.
>
>If you're only adding and subtracting, calculating in pennies isn't too
>difficult - you just have to create new formats to display decimal
>points correctly. It's when you start dividing or taking square roots
>that the going gets rough.
>
>
>--
>JackHamilton@FirstHealth.com
>Manager, Technical Development
>Metrics Department, First Health
>West Sacramento, California USA
>
>>>> "Steve Raimi" <steven.raimi@GM.COM> 09/24/2004 10:20 AM >>>
>>Store your data as pennies instead of dollars ?
>>Should be able to handle up to $90,071,992,547,409.92 without loss of
>>exactness.
>>(See http://support.sas.com/sassamples/quicktips/squeeze.html)
>>
>>I might have missed it, but what happens when you sum the round of
>each
>>amount * 100 ?
>>i.e. , sum (round (X*100)) as totalPennies
>>
>>Do you have any precision greater than a penny to deal with (or
>generally
>>fractions of minimum unit of currency) ?
>>
>>--
>>Richard A. DeVenezia
>>http://www.devenezia.com
>
>Evidently, SAS can't handle up to $90,071,992,547,409.92 - that's what
>I
>expected, but it's not working that way. The problem's not in the
>observations being added together. When I round them, the result is
>the
>same, but truncating at the penny, tenth of penny...through
>ten-thousandth
>of penny compromises the results. The problem is that the summed
>number
>(5,033,268,614.17) overruns the precision available in 8 bytes and the
>result is shown with .24 for the pennies.
>
>I just got an email from SAS Tech Support recommending multiplying by
>100
>and applying INT() (which would then conform to the 9 quadrillion
>maximum),
>and dividing the final result. What I'm trying to solicit is a way to
>prevent SAS novices in the group from having to make this adjustment,
>perform analyses, and then manually backing it out again.
>
>Steve
|