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.