Hey everyone,
I have a very easy question, but I am just not solving it. Let's suppose I have two departement with a given variable x. My dataset looks like:
Departement x
1 5
1 7
1 7
2 2
2 2
2 2
Now, I want to create a variable which sums all DISTINCT values of x by departement. So my dataset should look like:
Departement x y
1 5 12
1 7 12
1 7 12
2 2 2
2 2 2
2 2 2
How do I do that?
Best,
Simeon
Related Posts with Sum distanct values of a variable by group
can't delete a post?wish I could delete a post that seems rather silly now with more understanding. …
Group mean and separating data into 3 groupsHi, I have a large set of data sets and multiple variables. I want to do the following: 1. First I …
Panel dataI hope all is well and stay safe at home. I am a very beginner for STATA. I currently clean adminis…
Question related to loop/foreach vvvHi, Using the below sample data, I am trying to obtain the number of values in b1 (id=50_512) that e…
Setting up data for competing risk analysisHello, So I used a cox proportional regression model and I am pretty sure the assumptions have been…
Subscribe to:
Post Comments (Atom)
0 Response to Sum distanct values of a variable by group
Post a Comment