Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Float Precision


From   Jamie Madden <jamiem1234@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Float Precision
Date   Wed, 22 Aug 2012 10:16:50 +0100

Hi,

I am having difficultly understanding that I need to write float in
front of numbers when I am creating new variables in order to
compensate for precision issues. I have read "the penultimate guide to
precision" by William Gould but it does not seem to answer my problem.


For example if we look at (using Stata 12)

  sysuse auto, clear

at the first row and column "gear_ratio", the value appears to be 3.58
when in reality when you click on it, it is 3.579999. I understand the
reasoning behind this and understand if I want to create a variable
for example that is greater than or equal to 3.58 I should type

gen newvariable=1 if gear_ratio>=float(3.58)

Surely there is no need to type float for every variable that you
create in a dataset? Is there a way to set this up for your whole
dataset? Or change the default setting?

Thanks,
Jamie
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index