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
Need help estimating tail expectationsHi all, I am currently trying to calculate the Marginal expected shortfall (MES) based on the follo…
Saving coefficients in a columnDear All, I estimate a spatial regression model and then I calculate the marginal impact of the reg…
Recall: The use of pweights with regressHello Statalisters, I have been searching for an answer to the following question: "Can anyone poin…
Need help on ordering options in VAR modelHello, I have two questions. 1. What ordering options are available other than Cholesky Decompositio…
Total Factor Productivity Measurement through Production Function ApproachI intend to measure the TFP of manufacturing firms for 23 states through Production Function Approac…
Subscribe to:
Post Comments (Atom)
0 Response to Sum by ID in one data file
Post a Comment