tab rep78, subpop(foreign)
will do it directly. It isn't always as convenient, sometimes you need to
create a dummy variable for your subpop to get exactly what you want.
Michael Blasnik
[email protected]
----- Original Message -----
From: "Nick Cox" <[email protected]>
To: <[email protected]>
Sent: Thursday, December 11, 2003 11:01 AM
Subject: RE: st: RE: tab
> 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.)
>
<snip>>
> 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/