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

Re: st: missing data, tab ..., matcell(...) and marksample


From   Philip Ryan <philip.ryan@adelaide.edu.au>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: missing data, tab ..., matcell(...) and marksample
Date   Sun, 10 Aug 2003 13:47:09 +0930

Quoting "Paul  A. Jargowsky" <paul.jargowsky@utdallas.edu>:

> I have written a program to replace tabulate, but adds the ability to 
> format the output, whether frequencies or row/col/cell percents.  (Oddly, 
> there isn't a way to do this in Stata.  tabulate doesn't allow formatting 
> of output, and table doesn't allow row, col, or cell percents).  The 
> program also organizes the output a little differently, more to my liking.
> 
> The basic operation of the program is that "tab ..., matcell(X)" is invoked 
> internally to produce a matrix of frequencies; these are then manipulated 
> with matrix operations.
> 
> The problem I am having concerns missing values in the row or column 
> variable.  I won't to be able to retain them, but when I specify the 
> "missing" option to my table command, the missing observations are ignored. 
> I have discovered that the problem is the marksample command, which is 
> needed for byableness and ifableness.  In other words, in the following 
> code:
>  etc
>  etc


It is possible that the programs  -tab2way.ado-  and  -tab3way.ado-  available 
from the SSC site  may do most of what you need.  Consider the ubiquitous auto  
data set wherein the variable rep78 has 5 missing values. In the following 
example, the -missing- option really belongs to the Stata command -tabdisp- 
which -tab2way- calls and this just puts a dot "." in a missing cell.  The -
usemiss- option belongs to -tab2way- and allows missing categories to be 
tabulated. 

. tab2way foreign rep78, alltot miss usemiss allpct format(%5.1f)


Table entries are cell frequencies and cell, row and column percentages

-------------------------------------------------------------------------
          |                      Repair Record 1978                      
 Car type |       1        2        3        4        5  missing    TOTAL
----------+--------------------------------------------------------------
 Domestic |       2        8       27        9        2        4       52
          |     2.7     10.8     36.5     12.2      2.7      5.4     70.3
          |     3.8     15.4     51.9     17.3      3.8      7.7    100.0
          |   100.0    100.0     90.0     50.0     18.2     80.0     70.3
          | 
  Foreign |                         3        9        9        1       22
          |       .        .      4.1     12.2     12.2      1.4     29.7
          |       .        .     13.6     40.9     40.9      4.5    100.0
          |       .        .     10.0     50.0     81.8     20.0     29.7
          | 
    TOTAL |       2        8       30       18       11        5       74
          |     2.7     10.8     40.5     24.3     14.9      6.8    100.0
          |     2.7     10.8     40.5     24.3     14.9      6.8    100.0
          |   100.0    100.0    100.0    100.0    100.0    100.0    100.0
-------------------------------------------------------------------------
 

Type -findit tab2way-  and/or  -findit tab3way-

Phil



-- 
Philip Ryan
Associate Professor
Department of Public Health
University of Adelaide
5005 South Australia
AUSTRALIA
CRICOS Provider Number 00123M
----------------------------------------------------------- 
This email message is intended only for the addressee(s) 
and contains information that may be confidential and/or 
copyright.  If you are not the intended recipient please 
notify the sender by reply email and immediately delete 
this email. Use, disclosure or reproduction of this email 
by anyone other than the intended recipient(s) is strictly 
prohibited. No representation is made that this email or 
any attachments are free of viruses. Virus scanning is 
recommended and is the responsibility of the recipient.
*
*   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