LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2007)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 12 Jan 2007 10:30:07 -0500
Reply-To:   Richard Ristow <>
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   Richard Ristow <>
Subject:   Re: How can I round an expression to 2 decimal points?
Comments:   To: Boika Mileva <boikam@YAHOO.COM>
Comments:   cc: Spousta Jan <JSpousta@CSAS.CZ>, Marta García-Granero <biostatistics@TERRA.ES>, biostatistics@TERRA.ES
In-Reply-To:   <>
Content-Type:   text/plain; charset="us-ascii"; format=flowed

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 not to.

Back to: Top of message | Previous page | Main SPSSX-L page