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: display number of decimal places


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: display number of decimal places
Date   Tue, 11 Sep 2012 08:40:29 +0100

To insist on 6 decimal places, use a display format such as %8.6f. Use
-format- to assign that before you -list-.

I don't know what "the number of columns in a variable" is. However,
it helps to remember that to Stata the numbers you hold are all held
as binary. If the data were entered with a fixed number of decimal
places, you can (attempt to) show the same number of decimal places
with an appropriate format, as above. However, as your variable was
calculated as a z-score, 6 decimal places are a choice, and in no
sense at all are they a characteristic of the data. Seeing 6 decimal
places is just a side-effect of your display format %9.0g.

Reading should start with
http://blog.stata.com/2012/04/02/the-penultimate-guide-to-precision/

Nick

On Tue, Sep 11, 2012 at 8:21 AM, Rebecca Coates <r.coates@uq.edu.au> wrote:

> Is there a way I can produce a list that shows not the number of columns in a variable, but the  maximum number of decimal places after the decimal point?
> For example, the variable RPZ_S1 is a float variable, with the format %9.0g and contains Z scores.
> Example values look like this: -1.273682
> I would like to produce a list that tells me that variable RPZ_S1 contains 6 decimal places.
*
*   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