Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: BASIC QUESTION - counts of counts


From   "Dimitriy V. Masterov" <dvmaster@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: BASIC QUESTION - counts of counts
Date   Fri, 22 Jul 2011 15:06:51 -0400

Does this do what you want?

collapse (count) county, by(state)

DVM
On Fri, Jul 22, 2011 at 2:59 PM, Ben Hoen <bhoen@lbl.gov> wrote:
> Can someone help me to produce a table that counts the number of unique
> occurrences of a group inside another group?
>
> For example assume I had the following table:
>
> Number  State   County
> 1               NY      Madison
> 2               NY      Madison
> 3               PA      Somerset
> 4               NY      Oneida
> 5               PA      Somerset
> 6               PA      Wayne
> 7               PA      Luzerne
>
> I want to produce a table like this:
> State   County
> NY      2
> PA      3
>
> Any ideas?
>
> Ben
>
> Ben Hoen
> Principal Research Associate
> Lawrence Berkeley National Laboratory
> Office: 845-758-1896
> Cell: 718-812-7589
> bhoen@lbl.gov
> http://eetd.lbl.gov/ea/emp/staff/hoen.html
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index