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

st: RE: tab


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: tab
Date   Mon, 22 Dec 2003 16:11:07 -0000

In addition to other solutions proposed, 
all of which entail changing the data structure, 
you can also do something like this, with the step  
of creating one extra variable. 

. ssc inst groups 

. gen mpg5 = 5 * floor(mpg/5) 

. whelp groups

. groups mpg5 , show(f p P rP)

  +-----------------------------------------+
  | mpg5   Freq.   Percent     % <=     % > |
  |-----------------------------------------|
  |   10       8     10.81    10.81   89.19 |
  |   15      27     36.49    47.30   52.70 |
  |   20      20     27.03    74.32   25.68 |
  |   25      12     16.22    90.54    9.46 |
  |   30       4      5.41    95.95    4.05 |
  |-----------------------------------------|
  |   35       2      2.70    98.65    1.35 |
  |   40       1      1.35   100.00    0.00 |
  +-----------------------------------------+

Nick 
n.j.cox@durham.ac.uk 

Andreas Aschbacher

> 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                                         

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