Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: Float Precision


From   Jamie Madden <[email protected]>
To   [email protected]
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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index