[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
Nick Winter <nw53@cornell.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: A simpler count question Re: st: RE: Re: Counts of different values in one variable by another variable |

Date |
Fri, 26 Mar 2004 10:52:23 -0500 |

At 07:15 AM 3/26/2004 -0800, you wrote:

One approach is to upgrade to Stata/SE, whose -tabulate- command can handle up to 12,000 rows. So you could doabove). 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.

. 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 nw53@cornell.edu 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/

**Follow-Ups**:**Re: A simpler count question Re: st: RE: Re: Counts of differentvalues in one variable by another variable***From:*SamL <saml@demog.berkeley.edu>

**References**:**st: RE: Re: Counts of different values in one variable by another variable***From:*"Donnell Butler" <djbutler@princeton.edu>

**A simpler count question Re: st: RE: Re: Counts of different valuesin one variable by another variable***From:*SamL <saml@demog.berkeley.edu>

- Prev by Date:
**Re: st: local .... if** - Next by Date:
**Re: A simpler count question Re: st: RE: Re: Counts of differentvalues in one variable by another variable** - Previous by thread:
**Re: A simpler count question Re: st: RE: Re: Counts of differentvalues in one variable by another variable** - Next by thread:
- Index(es):

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