Dear Statalist users
I am generating a variable by year, year of birth, and district ID, using the following code
My question is if I generate a new variable using egen with 'group', i.e.
and then generate a variable of 'tot_events', i.e.
will it be correct to do so?
I am generating a variable by year, year of birth, and district ID, using the following code
Code:
bys year yob distt_id: gen tot_events = sum(events)
Code:
egen yr_yob_distt=group(year yob distt_id)
Code:
bys yr_yob_distt : gen tot_events = sum(events)

Comment