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
Set seed command not respected for -bsqreg-Hi all, I am using the following code to attempt to get reproducible results for a median regressio…
Dropping Variables Based on Other Variable, Student ProjectHey there, I'm a student working with Stata and have a data set that contains a variable associated…
Placebo test for model with fixed-effectsDears, I have a question about the model specification that I wonder if people can share their thou…
Categorical data analysis (likert scale)Hello everyone, I'm working with categorical data on likert scale (4 scales) referred to the same sa…
Placebo test for model with fixed-effectsDears, I have a question about the model specification that I wonder if people can share their thou…
Subscribe to:
Post Comments (Atom)
0 Response to Sum distanct values of a variable by group
Post a Comment