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!
Related Posts with How to sum variable by year for specific group id
Generate a new variable in a loop in different files and calculating the meanHi, I want to write a loop to generate a new variable called savings (income-expenditure) in two se…
Marginal effect after heckpoissonDear All, I am new to stata and I am using Heckpoisson, a poison regression model with endogenous s…
Numbering occurrences of a flag within patients.In the example below I have created OVERLAP_FLAG, which is equal to 1 where two consecutive regimens…
two stage IV approchbootstrap "repeated time values within panel" 2 SRI I'm trying to run 2sri approach(control functio…
Looping Over the numeric value of a variable and use it for the subsequent loop.Hi, thanks for your help in advance. I have the following dataset. And I come up with the following …
Subscribe to:
Post Comments (Atom)
0 Response to How to sum variable by year for specific group id
Post a Comment