Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • generating variable using "bysort" with three variables

    Dear Statalist users

    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)
    My question is if I generate a new variable using egen with 'group', i.e.

    Code:
     egen yr_yob_distt=group(year yob distt_id)
    and then generate a variable of 'tot_events', i.e.

    Code:
     bys yr_yob_distt : gen tot_events = sum(events)
    will it be correct to do so?

  • #2
    Yes.

    Comment


    • #3
      Thank you for the reply

      Comment

      Working...
      X