Statalist


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

Re: st: AW: numeric format


From   Sandra Rayman <[email protected]>
To   [email protected]
Subject   Re: st: AW: numeric format
Date   Fri, 14 Aug 2009 20:19:47 +0200

Thank you. I am now able to get the example code working, but it still
does not solve my problem of how, in general, to get a table in
non-exponential format.

For example, if (using the example) I say -table x id, format(%18.0fc)- I get:

------------------------------
          |         id
        x |                  1
----------+-------------------
 1.00e+12 |              1,000
------------------------------

And I get the same result if I say -table x id, format(%18.0fc)-. The
example works, where id is just 1 throughout, but that is not the kind
of table I need as it just gives the mean of the variable I am
interested in. I am still trying to get a basic table (as per the
comand above) with the actual numbers showing in non-exponential
format. Sorry to keep bothering people with this question but I am
just sure that there must be a simple way around it...

Yours,
Sandy.




On Fri, Aug 14, 2009 at 7:49 PM, Nick Cox<[email protected]> wrote:
> -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/
>

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