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
Adding IQR to trajectory line plot based on WIDE format dataDear experts, The Profileplot command can display the trajectory line based on median. profileplot …
Addition of date / ageHello , I'm working on computing age of firms from incorporation date. Some of the dates in my data…
testing reverse causality using VARI have panel data. I want to estimate the unrestricted VAR model, but when I type . var wroa Fdirect…
Dynamic panel data analysis with two dependent variablesHey, I want to do an arellano bond estimation on my data. My equation is GEit = a + b1GBit + b2 Xi…
Drop the values of a variable with if conditionHello everyone, I have a variable named "diversity" (and a bunch of other variables) and I would li…
Subscribe to:
Post Comments (Atom)
0 Response to Sum by ID in one data file
Post a Comment