```Date: Wed, 30 May 2007 10:37:49 -0500 Reply-To: "Beadle, ViAnn" Sender: "SPSSX(r) Discussion" From: "Beadle, ViAnn" Subject: Re: Rounding Issues (v.14) Comments: To: Matthew Reeder In-Reply-To: A<273436.60504.qm@web37001.mail.mud.yahoo.com> Content-Type: text/plain; charset="us-ascii" Your treading on uneven ground whenever you try to exactly compare decimal numbers stored in floating point binary formats. It's probably best to change the magnitude of your scale to avoid decimal scores before doing comparisons like this. Just how much precision do you need--perhaps multiply it by 10 and round that result. -----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Matthew Reeder Sent: Wednesday, May 30, 2007 9:23 AM To: SPSSX-L@LISTSERV.UGA.EDU Subject: Re: Rounding Issues (v.14) Hi Melissa, I think I considered this. I went into the dataview and increased the number of decimals shown on comp1 to 7. (x.xxxxxxx). In all but one instance, the value shows as 4.5000000 (one case snuck in at 4.4900000). SPSS still discriminates amongst those equaling 4.5 when computing the binary variable, however. Though it seems unlikely, perhaps it is occurring at a decimal place beyond the seventh (maybe rounding in the DO IF statement, as you suggest, will work here). As a check, I calculated the composite manually for these individuals. In all cases (sans the 4.49 case), the scores come out to 4.5 even. - Matt Melissa Ives wrote: It is likely due to the 2nd digit post-decimal. Those that are exactly 4.50 and greater get a 1. Those that are 4.45-4.49 get a 0. You may want to try an expression like DO IF (rnd(comp1,1)>=4.5). (totally untested!). Alternatively, you could expand the current format of comp1 to 2.2 instead of 2.1.) Melissa -----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Matthew Reeder Sent: Wednesday, May 30, 2007 8:22 AM To: SPSSX-L@LISTSERV.UGA.EDU Subject: [SPSSX-L] Rounding Issues (v.14) Hi all, I'm going to preface all of this with an apology. I'm sure this question has been asked a million times before and everyone knows the answer; however, it's driving me crazy. I've created a weighted composite from 11 variables (we'll call the composite comp1, which ranges from 1-10). I then create a binary variable (binvar) that assigns each case in the dataset a 0 or a 1, depending on whether or not the case reaches a certain minimum on comp1 (such as below). DO IF (comp1>=4.5) . COMPUTE binvar=1 . ELSE . COMPUTE binvar=0 . END IF . EXECUTE . Nothing complicated. Binvar will be my filter variable for subsequent analyses. Now for the problem. Let's say that there are 5 people in the dataset with a value of 4.5 on comp1. Binvar is being assigned a 0 for some of these people, and a 1 for others. In other words, even though they all are equal to 4.5, SPSS views them differently. Further, when I run frequencies on comp1, 4.5 appears twice, with different counts next to it. Why is it doing this? Thanks, - Matt --------------------------------- Luggage? GPS? Comic books? Check out fitting gifts for grads at Yahoo! Search. PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any attachments may contain PRIVILEGED AND CONFIDENTIAL information and is intended only for the use of the addressee. If you are not the designated recipient, or an employee or agent authorized to deliver such transmittals to the designated recipient, you are hereby notified that any dissemination, copying or publication of this transmittal is strictly prohibited. If you have received this transmittal in error, please notify us immediately by replying to the sender and delete this copy from your system. You may also call us at (309) 827-6026 for assistance. --------------------------------- Pinpoint customers who are looking for what you sell. ```

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