Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: bug?


From   "Ben Jann" <[email protected]>
To   [email protected]
Subject   Re: st: bug?
Date   Wed, 13 Jun 2007 14:12:31 +0200

This is due to limited storage precision (see -help data types-). Try
using doubles:

. clear

. set obs 1
obs was 0, now 1

. gen double famsoxc02=891.1

. replace famsoxc02=famsoxc02/100
(1 real change made)

. tab famsoxc02

 famsoxc02 |      Freq.     Percent        Cum.
------------+-----------------------------------
     8.911 |          1      100.00      100.00
------------+-----------------------------------
     Total |          1      100.00

ben

On 6/13/07, martina brandt <[email protected]> wrote:
dear statalist,

i am quite surprised because i always thought stata is perfect and everything that goes wrong is my own fault. but this time i am really puzzled:

gen famsoxc02=0
*...
replace famsoxc02= 891.1 if land== 6
*...

replace famsoxc02=famsoxc02/100

tab famsoxc02 land if index==1




i get 8.910999 - should be 8.911. Can anyone explain?

martina


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index