Nick
This is great. And now I understand what findit is.
I like the program you suggested...would this work in
tabulate (I wanted to get Percent as well). I did a
findit tabulate zero without any luck.
Thanks,
Buddy
--- Nick Cox <n.j.cox@durham.ac.uk> wrote:
> I can't speak for STATA. Curiously enough,
> the same question arises in Stata.
>
> The key question is how you expect Stata to
> know that "Green" was also a possible category.
>
> I guess that there are some languages in which
> the fact that "Green" was
> defined as a possible value by way of a
> specification
> of possible values would be enough.
>
> Stata doesn't work that way, however. Even if
> you define a set of value labels, Stata doesn't
> automatically tabulate those which are not
> represented in the data, or the subset of the
> data you specify. If these data are string,
> then why should Stata know that "Green" was
> a possible answer any more than (say) "Aardvark"?
>
> So you need a work-around in which you yourself
> spell
> out the possible values. The only ones I know
> are -tabcount- from SSC and the earlier -tabcond-
> from SSC. Note that had you used
>
> . findit zeros
>
> or
>
> . findit zero
>
> you would have found out about -tabcount- for
> yourself (together, naturally, with lots of
> other stuff).
>
> . findit tabulate zero
>
> would have zeroed in further on what you need.
>
> Here are a few simple examples of how -tabcount-
> works:
>
> . tabcount foreign, v(0 1 2 3 4)
>
> ----------------------
> Car type | Freq.
> ----------+-----------
> Domestic | 52
> Foreign | 22
> 2 |
> 3 |
> 4 |
> ----------------------
>
> . tabcount foreign, v(0 1 2 3 4) zero
>
> ----------------------
> Car type | Freq.
> ----------+-----------
> Domestic | 52
> Foreign | 22
> 2 | 0
> 3 | 0
> 4 | 0
> ----------------------
>
> . decode foreign, gen(FOREIGN)
>
> . tabcount FOREIGN , v("Domestic" "Foreign"
> "Martian" "Venusian") zero
>
> ----------------------
> Car type | Freq.
> ----------+-----------
> Domestic | 52
> Foreign | 22
> Martian | 0
> Venusian | 0
> ----------------------
>
> Missings are not shown by default. I guess the
> reason
> you have a puzzle about missing is that you think
> string
> "." means missing. With strings in Stata only the
> empty string
> "" means missing. If you have strings "." that you
> regard as missing you should just exclude those if
> desired
> by
>
> ... if COLOR != "."
>
> or replace them with empty strings.
>
> There was a more discursive account in the Stata
> Journal
>
> SJ-3-4 pr0011 . . . . . . . . Speaking Stata:
> Problems with tables, Part II
> Q4/03 SJ 3(4):420--439
>
> reviews three user-written commands
> (tabcount, makematrix,
> and groups) as different approaches to
> tabulation problems
>
> Nick
> n.j.cox@durham.ac.uk
>
> buddyb
>
> > I'm running STATA 8.
> >
> > If I had a multiple choice question, like, what is
> > your favorite color with red, yellow, black, green
> as
> > the given choices,and asked 7 people and got the
> > following results....
> >
> > Red 1
> > Yellow 2
> > Black 3
> > Green 0
> > . (missing)
> >
> > When I do a Table COLOR (this is my vname),
> > I get:
> >
> > Red 1
> > Yellow 2
> > Black 3
> >
> > The Green does not show up and I would like it
> too. I
> > want to repress the missing. How do I do this?
>
>
> *
> * 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/
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
*
* 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/