Statalist


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

RE: st: AW: numeric format


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: AW: numeric format
Date   Fri, 14 Aug 2009 18:49:24 +0100

-rnormal()- was introduced during the lifetime of Stata 10. 

The FAQ new members are asked to read asks users to make clear whether they are using an out-of-date version; the current version is 11. 

The equivalent command for Stata 9.2 uses -invnormal(uniform())-

However, as you guessed, that detail is irrelevant to your problem. 

This code worked for me with Stata 10.1. I no longer have Stata 9.2 on my machine: 

. clear

. set obs 1000
obs was 0, now 1000

. 
. gen x=1e12 

. 
. gen id =_n<=5000

. 
. table id, contents(mean x)

----------------------
       id |    mean(x)
----------+-----------
        1 |   1.00e+12
----------------------

. table id, contents(mean x) /*
>   */ format(%18.0fc)

------------------------------
       id |            mean(x)
----------+-------------------
        1 |    999,999,995,904
------------------------------


Nick 
[email protected] 

Sandra Rayman

Thank for for the prompt reply. I am unable to follow the suggested
code exactly as the 'rnormal' part gives me an error message that it
is an unknown function (perhaps because I am using Stata 9.2).
However, looking through the rest of the suggested code I thought that
the key part might be 'format(%11.0fc)', so I tried this but still
without success. Specifically, I tried
table date race [fweight = weight], format(%15.0fc) and several
variations of this, but the numbers are still presented in exponential
format. What am I missing here?

Thanks for clarification or any other suggestions.

2009/8/14 Martin Weiss <[email protected]>:

> *************
> clear*
> set obs 10000
>
> gen x=rnormal(10000000)
>
> gen id =_n<=5000
>
> table id, contents(mean x)
> table id, contents(mean x) /*
>  */ format(%11.0fc)
> *************

Sandra Rayman

> This is my first question to Statalist, and I'm afraid it's a bit of a
> basic one. I need a basic table of statistics and the problem I am
> having is that the numbers are shown in exponential rather than
> regular format. From the help function I read how to use the format
> command but the problem remains.
>
> I am using survey data and just need a basic table of the number of
> people, in each year, by race. The command I am using is:
> table date race [fweight = weight], format(%15.0g)
>
> I have tried increasing the number in the format command more and more
> (e.g. format(%18.0g)) but all that happens is that the columns get
> wider and the numbers are shown as e.g. 1.16e+07 whereas I need the
> full numbers. I know this should be easy, but from the help function
> and statalist archive I can't figure out how to do it.

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index