I am dealing with data with information of different candidates, the results of each candidate is distributed by class 1, 2, 3, 4
Candidate A Name | Sex | Votes |Candidate B Name | Sex | Votes | Candidate C Name | Sex | Votes | Candidate D Name | Sex | Votes
Class 1
Class 2
Class 3
Class 4
Firstly, I wish to group the columns of the information of a candidate, such that
Group A [ contains Candidate A Name | Sex | Votes of Candidate A]
Group B [ contains Candidate B Name | Sex | Votes of Candidate B]
Group C [ contains Candidate B Name | Sex | Votes of Candidate C]
After that, I wish to compare the number of votes of each candidate, and to Generate the name of the candidate only with the Highest Result into a new column
For example, if Candidate D obtains highest number of vote, name fo Candaidate D will be generate in a new column
Thank you in advance
Related Posts with How to group several columns?
gen whole lot random variables (and random order) efficientlyHi all, One of the statistical computations that I've been working on involves assigning 10,000 col…
TWFE for pooled cross sectionsHi, I currently have a dataset looking at 500 days, which is from 3rd April 2018 to 16th August 2019…
Lasso variables selectionDear all, I have an unbalanced panel, where I have a bunch of dummies, bunch of categorical variab…
Why is My Stata for-loop Code Wrong?I just want to compute descriptive statistics of the categorical time-invariant variables in the att…
Problem with omitting two categories using eventdd with a state-specific linear trend controlHello, everyone. I am using eventdd in Stata 17.0. I am trying to figure out how to keep event time …
Subscribe to:
Post Comments (Atom)
0 Response to How to group several columns?
Post a Comment