The by varlist: construct is reviewed, showing how it can be used to tackle a variety of problems with group structure. These range from simply doing some calculations for each of several groups of observations to doing more advanced manipulations making use of the fact that with this construct, subscripts and the built-ins _n and _N are all interpreted within groups. A fairly complete tutorial on numerical evaluation of true and false conditions is included.
BooleG.1854. An Investigation of the Laws of Thought.London: Walton and Maberley.
2.
CoxN. J.2001. Speaking Stata: how to repeat yourself without going mad. Stata Journal1: 84–95.
3.
HeathP., and SenetaE.2001. George Boole. In Statisticians of the Centuries, eds. HeydeC. C., and SenetaE., 167–170. New York: Springer-Verlag.
4.
LachenbruchP. A.1992. ip2: A keyboard shortcut. Stata Technical Bulletin9: 9. In Stata Technical Bulletin Reprints, vol. 2, 46. College Station, TX: Stata Press.