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

RE: st: AW: numeric format

From   "Martin Weiss" <>
To   <>
Subject   RE: st: AW: numeric format
Date   Fri, 14 Aug 2009 20:12:57 +0200


Nick`s code makes my original -gen id =_n<=5000- look ridiculous, as he has
only 1000 obs, and you want to replace it by

-gen byte id=1-


-----Original Message-----
[] On Behalf Of Nick Cox
Sent: Freitag, 14. August 2009 19:49
Subject: RE: st: AW: numeric format

-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

. 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


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 <>:

> *************
> 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:

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index