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

RE: st: RE: tab


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: tab
Date   Thu, 11 Dec 2003 16:01:56 -0000

Thanks for the reference to -, subpop()- which
somehow has never registered with me; indeed
I don't think I ever understood it.

Here is the sort of example I had in mind. Some
people would like explicit zeros in the case
of rep78 == 1, 2 & foreign == 1. Can -, subpop()-
help here, directly, without changing the dataset?

(This was one motivation for writing -tabcount-,
now on SSC. I thought that such tables should be
possible on the fly, so far as the user is
concerned.)

. bysort foreign : tab rep78

______________________________________________________________________
_________
-> foreign = Domestic

     Repair |
Record 1978 |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |          2        4.17        4.17
          2 |          8       16.67       20.83
          3 |         27       56.25       77.08
          4 |          9       18.75       95.83
          5 |          2        4.17      100.00
------------+-----------------------------------
      Total |         48      100.00

______________________________________________________________________
_________
-> foreign = Foreign

     Repair |
Record 1978 |      Freq.     Percent        Cum.
------------+-----------------------------------
          3 |          3       14.29       14.29
          4 |          9       42.86       57.14
          5 |          9       42.86      100.00
------------+-----------------------------------
      Total |         21      100.00

Nick
[email protected]

> >2. -tabulate- is reluctant to tabulate classes which
> >don't exist in the data. In particular, you can't
> >get zero counts out of -tabulate <myvar>-.
>
> -tabulate- can give zero counts, using the -subpop(...)- option.
>
> If var2 restricts the dataset so as to exclude some of the
> values of myvar,
> then
>
>   tabulat myvar, subpop(var2)
>
> will have zero entries for the values in question.
>
> (And presumably, this would hold under -if- or -in-
> restrictions, as long
> as var2 further restricts the dataset so as to exclude some
> values of myvar.)
>
> If you really want to see some nonexistant values in a
> -tabulate-, you can
> extend the dataset to include them, and then create a
> variable that serves
> as an indicator for the "actual" data. Then present that
> variable in the
> -subpop(...)- option.

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