Bookmark and Share

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]

Re: st: BASIC QUESTION - counts of counts


From   "Dimitriy V. Masterov" <[email protected]>
To   [email protected]
Subject   Re: st: BASIC QUESTION - counts of counts
Date   Fri, 22 Jul 2011 15:32:26 -0400

Ben,

Try a preserve before and a restore after.

DVM

On Fri, Jul 22, 2011 at 3:30 PM, Ben Hoen <[email protected]> wrote:
> Dimitry's file is perfect, except that I do not want to have to reload the
> original table (Fernando - there is a host of other pertinent info
> additionally in the table so they are not actually duplicates as I showed
> below in my simple example).
>
> So, is there any way to produce what is in the Dimitry table in the output
> panel? (for example like a tab produces a table of frequencies)
>
> Ben
> ======================================
> Re: st: BASIC QUESTION - counts of counts
> From      Fernando Rios Avila <[email protected]>
> To        [email protected]
> Subject           Re: st: BASIC QUESTION - counts of counts
> Date      Fri, 22 Jul 2011 15:10:05 -0400
>
> 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
> <[email protected]> wrote:
>> Does this do what you want?
>>
>> collapse (count) county, by(state)
>>
>> DVM
>> On Fri, Jul 22, 2011 at 2:59 PM, Ben Hoen <[email protected]> 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
>
>
>
> *
> *   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index