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
sex of the first born childhi stata user , I'm having trouble in generating sex of the first born child. can anyone help me ? …
Manipulating panel data based on previous time valuesHi, I am working with a district-year panel data set in which there are 10 years. I am interested i…
Differences in margins postestimation command for tpoisson relative to poissonI'm currently using a truncated poisson model with command tpoisson and ll(0) and ul(6) for a depend…
Extract Std.Err. and 95% Conf. Interval after regressionHi Statalist After running a regression, I understand we can extract the estimated coefficients in …
plotting interaction for xtpoissonHi Statalist fellow, I have run an analysis but I don't trust my result. I would be extremely apprec…
Subscribe to:
Post Comments (Atom)
0 Response to Sum distanct values of a variable by group
Post a Comment