Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Well, i would first drop the duplicate obsevations:
duplicates drop state county
and then use Dimitriy code.
On Fri, Jul 22, 2011 at 3:06 PM, Dimitriy V. Masterov
> Does this do what you want?
> collapse (count) county, by(state)
> On Fri, Jul 22, 2011 at 2:59 PM, Ben Hoen <firstname.lastname@example.org> 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?
* For searches and help try: