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/