<.>
How about generating a total variable?
egen sumvar1 = sum(var1), by(id)
or use -collapse- with the -by- option to (temporarily: see -help
preserve-) create a dataset of totals.
If doing this on the fly is enough, -help tabstat-. E.g.
tabstat var1, by(id) stat(sum)
Kit Baum | Boston College Economics & DIW Berlin | http://ideas.repec.org/e/pba1.html
An Introduction to Stata Programming
| http://www.stata-press.com/books/isp.html
An Introduction to Modern Econometrics Using Stata | http://www.stata-press.com/books/imeus.html
On Aug 2, 2009, at 02:33 , statalist-digest wrote:
I have a (possible) dummy question. I have a panel data set like the
following:
id year var1
01 2000 10
01 2001 20
02 2000 15
02 2001 25
I want to create a new observations, with id=03, that sum the var1
over the other ids. Obviously, I'm no going to use this observations
to make some estimation, but total statistics. How can I generate this
aditional observations.
*
* 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/