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 on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: Rounding Errors Stata 12


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Rounding Errors Stata 12
Date   Wed, 13 Feb 2013 14:39:15 +0000

This is, surprising though it may seem, entirely standard and acceptable, and
a consequence of the fact that decimals such as anything.8 can not be
held _exactly_ as binaries.

A short answer is that to see just one decimal place, you need to
specify a format such as %8.1f. See
-help format-. For a much longer answer, see for a start

Blog    . . . . . . . . . . . . . . . . . . The penultimate guide to precision
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . W. Gould
        4/12    http://blog.stata.com/2012/04/02/the-penultimate-
                guide-to-precision/

Nick

On Wed, Feb 13, 2013 at 2:25 PM, Gray, Charles <gray.c@east.ei.com> wrote:
> I am having an issue with Stata 12 adding decimal places to data that I
> insheet. I simply have a dataset in .csv format. The dataset contains a
> variable 'item_revenue.' When I open the dataset in Excel, several
> observations have a value of 60237.8 for the 'item_revenue' variable.
> However, when I insheet the dataset into Stata, these values change to
> 60237.801. My insheet command is simply,
>
> insheet using "data.csv", comma clear
>
> My understanding is that the .csv format saves only the text and values
> as they are displayed in cells of the active worksheet. So does anyone
> know why Stata would add decimal places to a variable?
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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