Thanks to Kit Baum, a new package called -panels- is now available
from the SSC Archive. Type
. ssc install panels
to install.
-panels- has two purposes:
(1) Quickly count panels (groups) in a dataset and display some basic
information about the sizes of the panels. You can also use -panels-
simply to count the number of distinct (unique) values of a variable.
See Cox (2007) for some thoughts on counting panels.
Cox, N. J. (2007). Speaking Stata: Counting groups, especially panels.
The Stata Journal 7(4):571-581.
http://www.stata-journal.com/article.html?article=dm0033
(2) Compute statistics based on panel units (instead of individual
observations). -panels- can be used as a prefix command to other Stata
commands to apply them to panel units instead of individual
observations. This is useful, for example, if you want to compute
frequency
distributions or summary statistics for panel characteristics.
Examples:
. webuse nlswork, clear
(National Longitudinal Survey. Young Women 14-26 years of age in 1968)
. panels idcode
Number of obs = 28534
Number of groups = 4711
Obs per group: min = 1
avg = 6.056888
max = 15
. panels idcode if race==2
Number of obs = 8051
Number of groups = 1325
Obs per group: min = 1
avg = 6.076226
max = 15
. panels idcode: tabulate race
1=white, |
2=black, |
3=other | Freq. Percent Cum.
------------+-----------------------------------
1 | 3,329 70.66 70.66
2 | 1,325 28.13 98.79
3 | 57 1.21 100.00
------------+-----------------------------------
Total | 4,711 100.00
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/