Answers!
Edwin Leuven's suggestion worked:
sort x
count if x!=x[_n-1]
Thanks for all the help.
Sam
On Fri, 26 Mar 2004, Nick Winter wrote:
> At 07:15 AM 3/26/2004 -0800, you wrote:
> >above). My problem is that I -tab1- a variable but there are too many
> >values for it to run the frequency distribution. I could use by, but that
> >could get very tedious with counting, and could be prone to error when I
> >add up across the by variable. I expect there to be something on the
> >order of 3700 values, but I have to check to be sure.
>
> One approach is to upgrade to Stata/SE, whose -tabulate- command can handle
> up to 12,000 rows. So you could do
>
> . quietly tab x
>
> and then grab r(r)
>
> If the values are all integers, then the command -levels- (available from
> SSC) might do the trick for you.
>
> Or, from first principles:
>
> . bysort x: gen count = (_n==1)
> . replace count = sum(count)
> . sum count
>
> and grab r(max)
>
> --Nick Winter
>
> --Nick Winter
>
>
> --------------------------------------------------------
> Nicholas Winter 607.255.8819 t
> Assistant Professor 607.255.4530 f
> Department of Government [email protected] e
> 308 White Hall falcon.arts.cornell.edu/nw53 w
> Cornell University
> Ithaca, NY 14853-4601
>
> *
> * 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/