Statalist The Stata Listserver


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

RE: st: an ordinary two-way table


From   "Giovanni Vecchi" <[email protected]>
To   <[email protected]>
Subject   RE: st: an ordinary two-way table
Date   Fri, 11 May 2007 16:07:54 +0200

Chris and Nick, thanks for your suggestions. As you both say, the
problem with tabcount is that it does not allow row and column totals.

I'm always puzzled when I find Stata unable to offer easy answers to
easy questions (as the one raised in my posting). Faced with the
failure to produce a simple two-way table, I ask myself: is it me or
is it Stata? And my answers start looping ... "it's me", "it's Stata",
"it's me", "it's Stata",... time goes by, frustration/irritation start
off, etc...

A quick reaction to Nick's suggestion. In my opinion, there is an
issue on the opportunity cost of pursuing a Mata-based strategy.  My
guess is that it is high for most Stata users.

My point: ordinary two-way tables should be within the reach of
Mata-almost-illiterate users. Needless to say, I am an outstanding
member of this club. 

A bottom line: hope StataCorp is sympathetic to my argument... :)

Best,

- Giovanni 

> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of 
> [email protected]
> Sent: Friday, May 11, 2007 3:35 AM
> To: [email protected]
> Subject: Re: st: an ordinary two-way table
> 
> 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   [email protected]
> > 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/


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index