Hello everyone,
I have dataset like this,
ID value1 value2 value3 ....
1 10 20 30
1 20 20 30
1 40 20 30
2 10 50 80
2 30 50 80
3 40 30 90
3 50 30 90
. . . .
. . . .
. . . .
As you can see, only the value of var1 is different, and the values of var2 and var3 are all the same.
I want to make my data file like this.
ID value1 value2 value3 ....
1 70 20 30
2 40 50 80
3 90 30 90
value1 is the sum of value1 per ID, and value2 and value3 are fixed values.
I tried to use the duplicates and the egen function, but it did not work and I have no idea anymore.
Is there anyone you can give me a hint about?
Thanks in advance.
HS Jang from South Korea
Related Posts with Sum by ID in one data file
clogit or logit for a Difference-in-Difference model with fixed effectsHi everyone, I was hoping you might be able to help with this question for my thesis. I'm running a…
Eventdd errorHi, I am trying to estimate the eventdd technique on panel data using the code created by @Damian C…
placebo analysis: time falsification and location falsificationHi , My variable of interest is an indicator variable (LAW) that equals 1 if a firm is in a state h…
Coefplot fit next to each otherHi, I am creating three coefficient plots with the same variables and want them to be one next to ea…
Missing SE in cox regression.Dear All, I am new to survival analysis using Stata and am trying to estimate a standard cox proport…
Subscribe to:
Post Comments (Atom)
0 Response to Sum by ID in one data file
Post a Comment