Apologies if there is already a thread on this but can anyone point me to a sample picture or other format that will display cents with a decimal point and two digits to the right of it, i.e. as if the quantity is dollars and cents. Dividing by 100 introduces rounding errors which add up so that PROC COMPARE lists half my records with differences of the order or 10E-07. Alternatively can one specify a FUZZ type of option in that PROC to deem differences less that 5*10E-03 (say) to be taken as zero?
I know what you mean. When currency amounts are stored as dollar values with fractional cents when a large number of records are aggregated the total can be incorrect. This stems from the fact that 1 cent as .01 cannot be represented accurately in binary (just like 1/3 cant be represented accurately in decimal .333333 recurring). As you suggested a good way to handle this is to store the currency value as an integer number of cents and then format it as a dollar value by dividing by 100 to display it.
The following code shows a sample dollarc format that formats a integer cents value as a dollar and cents amount. This particular sample puts a negative amount in brackets. If you don't want that its easy enough to modify the format.
Here's the sample code:
* a format that displays a cents integer value as a dollar value and negative values in parentheses;
low - <0 = '00,000,000,000,009.99)' (mult=1 prefix='($')
0 - high = '00,000,000,000,009.99 ' (mult=1 prefix='$')