At 02:54 AM 1/12/2007, Boika Mileva wrote:
>I have to calculate an expression into a variable with a FORMAT F6.2
>and I need it rounded to 2 decimal points.
At 03:14 AM 1/12/2007, Spousta Jan responded:
>Compute rounded2 = RND(varname*100) / 100.
which is, of course, how you do it - implemented particularly neatly by
Marta's elegant macro.
The other answer is, seriously consider whether you should do it at
all. If you use the F6.2 format, the value will display properly
rounded. Rounding the value isn't necessary; and it introduces a small
error in the value, if you're going to use it in later calculations.
I suggested this once to a poster who, it turned out, was implementing
an odd accounting algorithm, and needed to match its rounding rules
exactly. But if the rounding is just for display, it's generally better