Speaking Stata: Counting groups, especially panels

dc.creatorCox, Nicholas J.
dc.date2017-04-01T19:41:39Z
dc.date.accessioned2026-07-09T05:53:21Z
dc.descriptionCounting panels, and more generally groups, is sometimes possible in Stata through a reduction command (e.g., collapse, contract, statsby) that produces a smaller dataset or through a tabulation command. Yet there are also many problems, especially with irregular sets of observations for varying times, that do not yield easily to this approach. This column focuses on techniques for answering such questions while maintaining the same data structure. Especially useful are the Stata commands by: and egen and indicator variables constructed for the purpose. With by: we often exploit the fact that subscripts are defined within group, not within dataset. egen functions are often used to produce group-level statistics. Tagging each group just once ensures that summaries, including counts, are of groups, not individual observations.
dc.identifierOther:dm0033
dc.identifierdoi:10.22004/ag.econ.119295
dc.identifierhttps://ageconsearch.umn.edu/record/119295/files/sjart_dm0033.pdf
dc.identifierhttp://ageconsearch.umn.edu/record/119295
dc.identifier.urihttp://hdl.handle.net/123456789/569677
dc.languageeng
dc.publisher
dc.sourcehttp://ageconsearch.umn.edu/record/119295
dc.titleSpeaking Stata: Counting groups, especially panels
dc.typeText

Archivos