Thanks to all. This looks perfect. Will let you know if more problems
emerge.
Michael
On Sat, 2 Apr 2005, Kit Baum wrote:
> My previous solution created a dummy, not a counter, and I see that is
> not what is wanted. Andrew Felton's solution
>
> sort ccode years
> by ccode: gen nukecount = sum(nukes)
>
> could also be written as
>
> bys ccode (years): gen nukecount = sum(nukes)
>
> although one would hope that since this is panel data that it has been
> declared as such by tsset; in that case no sorting is required.
>
> But Paul Millar is wrong: GENERATE's sum function creates a running
> sum, not a constant as does EGEN's sum function. generate sum is indeed
> the right tool here.
>
> Kit Baum, Boston College Economics
> http://ideas.repec.org/e/pba1.html
>
> *
> * 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/
>
*******************************************************************************
Michael Horowitz
78 Kirkland Street, #1
Cambridge, MA 02138
*
* 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/