Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: counting subgroups in a large group


From   "Jesper B. Sorensen" <[email protected]>
To   [email protected]
Subject   Re: st: RE: counting subgroups in a large group
Date   Fri, 06 Jun 2003 15:27:05 -0400

bysort course section: gen flag=_n==1
by course: egen nsections=sum(flag)
drop flag


At 03:42 PM 6/6/2003 -0400, you wrote:
I need to find the number of groups in a larger group: the number of *sections
in a *course. Of course, I can do this:

sort course
by course: tabulate sections

One would then count the sections by eyeballing them in the tabulation, but
in my data, a course can have many many sections.

The conceptual idea would be analgous to this fantasy coding:

by course: codebook section

*
* 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/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jesper B. S�rensen
Richard S. Leghorn (1939) Associate Professor of Strategic Management
Sloan School of Management
Massachusetts Institute of Technology
E52-581
Cambridge, MA 02142
http://web.mit.edu/sorensen/www/
(617) 253 7945  -- voice
(617) 253 2660  -- fax


*
*   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/



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