Hello stata-users,

I need to create a two column dataset by age-class and number of events. I can do so manually by using
Code:
tab age events
. However, I am sure there's perhaps a better way to do it.
Here's sample dataset which should give you something like age: 18; events: 12 (here event is codified by 0) , age 19; events: counts of 0s, and so on.

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input int age byte event
18 0
18 0
28 0
18 0
38 1
18 0
48 0
18 0
58 0
18 0
68 1
18 0
38 0
18 1
18 0
68 0
18 0
18 0
18 0
18 0
end
Thank you.