Why doesn't -tab- work?
Here is another way (code taken from -codebook-) if you have more than 3,000
(Intercooled) or 12,000 rows (Stata/SE):
. webuse union,clear
(NLS Women 14-24 in 1968)
. tempvar tag
. bys id: gen byte `tag'= 1 if _n==1
(21766 missing values generated)
. count if `tag'==1 & !missing(id)
4434
. return list
scalars:
r(N) = 4434
Scott
> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Suzy
> Sent: Monday, October 10, 2005 6:34 PM
> To: [email protected]
> Subject: st: need a quick count
>
> Hi Statalisters:
>
> I have a categorical variable with an unknown number of categories
> because there are so many (hundreds) of categories. I can't figure out a
> way to get a quick count of the total number of categories for this
> variable- but there must be a way to obtain this information. Sum, list,
> tab, and prop don't work.
>
> Am I missing something??
>
> Thanks!
> *
> * 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/
*
* 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/