Announcement

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

  • How to sum variable by year for specific group id

    The original dataset has the following structure:

    group_id | year | varx
    1 1998 5
    1 1998 5
    1 1999 2
    2 1998 1
    2 1998 1
    2 1998 1
    2 1999 3


    The outcome should look like:

    group_id | year | varx
    1 1998 10
    1 1999 2
    2 1998 3
    2 1999 3


    Thank you for your suggestions!
    Last edited by Bran Ecker; 30 Nov 2021, 14:57.

  • #2
    Code:
    collapse (sum) varx ,by(id year)

    Comment


    • #3
      Great, thank you!

      Comment

      Working...
      X