Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: tab


From   Ulrich Kohler <kohler@wz-berlin.de>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: tab
Date   Mon, 22 Dec 2003 15:07:56 +0100

Andreas Aschbacher wrote:
> Dear collegues !
> I want to add the column  > 100 - Cum <
> to the following table which I get with tab z1
>
> . tab z1
>
>                            z1 |      Freq.     Percent        Cum. 
> 100 - Cum
> ------------------------------+-----------------------------------
>   1. < 20 mSv                 |      2,086        0.52        0.52
>   99.48
>       2.  >= 20 mSv           |     32,767        8.21        8.73
>  ..
>       3.  >= 40 mSv           |    105,238       26.35       35.08
> ..
>       4.  >= 60 mSv           |    122,592       30.70       65.78
> ..
>       5.  >= 80 mSv           |     77,056       19.30       85.08
> ..
>      6.  >= 100 mSv           |     31,572        7.91       92.99
> 7.01
>      ........                                ........           .....
> .......           ......
>
> How to get the table with 100 - Cum inclusive ?
> Thank you very much
> andreas

I propose to form a dataset containig the results and and to display this 
dataset either with -list- or -tabdisp-. You may also transfer the dataset 
with the results to a Desktop Publishing Program with -outsheet-. 

The following may deal as a starting point:

--------------------------------------
contract z1, freq(n)
gen N = sum(n)
gen f = n/N[_N] * 100
gen F = sum(f)
gen F100 = 100 - F
tabdisp z1, cellvar(n f F F100)
-------------------------------------

Be aware that -contract- changes your dataset. You should therefore save you 
data before using the above. 


regards
uli
















-- 
kohler@wz-berlin.de
+49 (030) 25491-361


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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   |   What's new   |   Site index