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

st: Table with supercolumn and multiple percent entries in each cell


From   Daniel Egan <dp.egan@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Table with supercolumn and multiple percent entries in each cell
Date   Mon, 27 Sep 2004 11:30:45 -0400

Good morning, 

I feel like maybe I am just overlooking something very simple,
especially considering the ongoing conversation of tabstat etc, but I
haven't been able to figure out how to do this myself yet...

I want a table with a supercolumn with 5 cell entries corresponding to
the percentage of observations by column.

for example

table inum ynum, by(fnum) row

yields. 

           y1     y2     y3     y4     y5
---------------------------------------------------
f1    i |    11i    12i    13i    14i     15i
      ii |    11ii   12ii    13ii   14ii    15ii
----------------------------------------------------            
f2    i |    21i    22i     23i    24i    25i
      ii |    21ii   22ii    23ii   24ii    25ii
------------------------------------------------------      
Total    T1n     T2n    T3n   T3n   T3n



I want: 


        |     y1        |  y2         |      y3      |     y4     |     y5
--------------------------------------------------------------------------
f1    i |    11i/T1n  |  12i/T2n  |  13i/T3n   |  14i/T4n  |   15i/T5n
      ii |    11ii/T1n |  12ii/T2n |   13ii/T3n  | 14ii/T4n  |   15ii/T5n
----------------------------------------------------------------------------
f2    i |    21i/T1n  |  22i/T2n  |   23i/T3n   |  24i/T4n  |  25i/T5n
      ii |    21ii/T1n |  22ii/T2n |   23ii/T3n  | 24ii/T4n  |  25ii/T5n
--------------------------------------------------------------------------------------------
Total  |  T1n          |   T2n      |     T3n      |  T3n       |    T3n


Note: Txx vary considerably, and my IJix are not indicators. 

Is there anyway to do this without creating new variables? Feel free
to berate me if I am being slow.

Thanks in advance, 

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