|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: variables precision
From
Kyle Hood <[email protected]>
To
[email protected]
Subject
Re: st: variables precision
Date
Wed, 4 Apr 2007 20:10:48 -0400 (EDT)
Another possibility would be to generate a variable that is the
difference between the two variables,
gen z = y - x
and count if z is small, e.g.,
count if z > 0.0000001
This won't be perfect, but as long as the variables are generated at
random, there's only a tiny chance that they'll fall within such a small
bound randomly.
Kyle
On Thu, 5 Apr 2007, sara borelli wrote:
I tried but after converting to float stata still
reports that for some observations the inequality is
satisfied , and I do not understand why...
--- Kyle Hood <[email protected]> ha scritto:
couldn't you just recast both as floats (generating
a new pair of
variables), do the operation, and then, if you wish,
delete the new
variables?
something like this
gen float xf = x
gen float yf = y
gen z = xf < yf
drop xf yf
On Thu, 5 Apr 2007, sara borelli wrote:
Dear Statalist members
I know this is a precision question already posted
in
the past, but I have difficulties to understand
the
right way to go even after looking at the archives
of
statalist
I have two variables:
x y
17.68 17.68
15.56 15.56
19.27 19.27
5.3 5.3
If I write 'count if x<y' stata says that all
observations satisfy this inequality, when in fact
the
values 'look' the same. I think this has to do
with the fact that x is stored as double, while y
is
stored as float. Is there any way I can say stata
to
read the values as they "appear" and thus
performing
calculations correctly (in this case I would need
stata say that there are zero observations for
which
x<y)? I am sorry to repeat this question, but any
suggestion would be really appreciated
thanks
Sara
___________________________________
L'email della prossima generazione? Puoi averla
con la nuova Yahoo! Mail:
http://it.docs.yahoo.com/nowyoucan.html
*
* 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/
___________________________________
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail:
http://it.docs.yahoo.com/nowyoucan.html
*
* 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 |