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

st: RE: need a quick count


From   "Scott Merryman" <smerryman@kc.rr.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: need a quick count
Date   Mon, 10 Oct 2005 22:05:04 -0500

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: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] On Behalf Of Suzy
> Sent: Monday, October 10, 2005 6:34 PM
> To: statalist@hsphsun2.harvard.edu
> 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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index