Statalist


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

Re: st: RE: Re: table with zero rows


From   Jeph Herrin <[email protected]>
To   [email protected]
Subject   Re: st: RE: Re: table with zero rows
Date   Thu, 04 Sep 2008 09:34:25 -0400

Thanks to Garry, Kit, & Nick for the suggestions. Looks like
-fre- will serve my current purposes, but I snagged the others
for future reference.

cheers,
Jeph

Nick Cox wrote:
Thanks to Kit for the plug. The njc_stuff he refers to is also on SSC.

I endorse Ben Jann's -fre- as the best bet for tabulation of single
variables when -tabulate- does not answer the need. It does an outstanding job, with a
splendid set of bells and whistles.
But -fre- is, as its help clearly states, only for univariate tables. If
you wanted the same functionality for two or more variables, then
-tabcount- from SSC (and also -groups- from SSC) are possibilities.
SJ-3-4 pr0011 . . . . . . . . Speaking Stata: Problems with tables,
Part II
Q4/03 SJ 3(4):420--439 (no
commands)
reviews three user-written commands (tabcount, makematrix,
and groups) as different approaches to tabulation problems

gives discussion and its .pdf is accessible to all, subscribers to the
Stata Journal or no.
Nick [email protected]
Kit Baum

In addition to Ben Jann's -fre-, help njc_best_stuff reveals

ssc describe tabcount

Jeph Herrin

Sometimes a variable which takes sequential integer
values does not take all possible values that it could.
For instance, -myvar- may represent a survey response
on a scale of 1 to 5, but no respondents chose "3".

I would like to generate frequency tables for such variables
that include rows for the unused values. So

      myvar |      Freq.     Percent        Cum.
- ------------+-----------------------------------
          1 |         37       17.54       17.54
          2 |        169       80.09       97.63
          3 |          0        0.00       97.63
          4 |          5        2.37      100.00
          5 |          0        0.00      100.00
- ------------+-----------------------------------
      Total |        211      100.00


Now, I can see how to write the do-file, but I keep
putting it off in the hopes of finding some trick
(or existing program) that will do the job.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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