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

st: RE: table of counts of values for N variables


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: table of counts of values for N variables
Date   Fri, 4 Mar 2005 16:28:37 -0000

Program -tabm- from -tab_chi- on SSC has this aim. 

Row percents come for free, as all -tabm- does is 
restructure the data on the fly and then call up 
-tab-. That is an upstream solution, rather than 
your downstream strategy of picking up output and 
re-assembling it. 

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

Daniel Egan
 
> I have about 30 variables that take on integer values from 1 through
> 6. I would like to create a table with the rows being the variables,
> the columns consisting of values 1/6, and the cells consisting of the
> count of the variable equal to that value.  There may be missings,
> which I would like to include.  Since it would include values that
> would otherwise be left out by -tab-, this is similar to -tabcount-,
> but vertically. I don't need to be able to specify the value range
> (the numlist in tabcount), since they are cleaned within the range.
> 
> vertab var1-var3, missing
> 
>                  Value
>          1   2   3   4   5   6    .     N
> 
> var1   2   4   5   2   1   4    0    18
> var2   7   4   2   2   0   3    0    18
> var3   9   8   0   0   0   0    1    18
> 
> The ability to have row percents would also be fantastic. 
> 
> I have looked into using -tab, matcell()- but am not sure how to
> recombine the matrices once they have been stored in a manner which
> would be consistent across values (i.e., if var3 has no 3's, then the
> third value is actually for value 4).
> 
> I feel like I am missing some obvious command, but am not sure what. 

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