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

st: table of counts of values for N variables


From   Daniel Egan <[email protected]>
To   [email protected]
Subject   st: table of counts of values for N variables
Date   Fri, 4 Mar 2005 10:56:18 -0500

Hello all, 

A problem that involves a simple little table: 

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. 

Thanks, 

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