Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: an ordinary two-way table


From   cryan@binghamton.edu
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: an ordinary two-way table
Date   Thu, 10 May 2007 21:34:54 -0400 (EDT)

sysuse auto, clear
drop if rep78==1
tabcount rep78 foreign, v1(1/5) v2(0/1) zero

This produced the following for me:

 tabcount rep78 foreign, v1(1/5) v2(0/1) zero

------------------------------
Repair    |
Record    |      Car type
1978      | Domestic   Foreign
----------+-------------------
        1 |        0         0
        2 |        8         0
        3 |       27         3
        4 |        9         9
        5 |        2         9
------------------------------

But now I see that the resulting table does not contain a column for
totals, so not exactly what you want.  You had probably gotten this far
already . . . .

--Chris Ryan


 Dear Statalisters,
>
> I'd like to produce a simple two-way table... but have failed to do
> so. To illustrate:
>
> sysuse auto, clear
> replace rep78=. if rep78==1
>
> The table that I've been dreaming of during the last hour or so (sic!)
> is the following:
>
>
>     Repair |
>     Record |       Car type
>       1978 |  Domestic    Foreign |     Total
> -----------+----------------------+----------
>          1 |         0          0 |         0
>          2 |         8          0 |         8
>          3 |        27          3 |        30
>          4 |         9          9 |        18
>          5 |         2          9 |        11
> -----------+----------------------+----------
>      Total |        46         21 |        67
>
>
> Please note the first row with all zeros...
>
> I've tried with tabcount, tab2way, tabdisp, etc. ... but did not
> manage to obtain *exactly* the above table.
>
> Any suggestions?
>
> Best,
>
> - Giovanni
>
>
> ----------------------------------------------------------
> Giovanni VECCHI
> Dipartimento di Economia e Istituzioni
> UniversitÓ di Roma "Tor Vergata"
> Via Columbia, 2
> 00133 Roma
> Italy
>
> voice   + 39 06 7259 5730
> fax     + 39 06 2020 500
> email   giovanni.vecchi@uniroma2.it
> webpage http://www.economia.uniroma2.it/vecchi/
> ----------------------------------------------------------
>
>
>
> *
> *   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/
>


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