Hello and thank you!
I am trying to generate a new variable that is the variable with the max value among a list of 8 variables. When I use the egen command with a rowmax function is it possible to list which variable within my list is variable for the max value? I'ld like to create this new variable across observations.
For example,
id v1 v2 v3 v3 v4 v5
1 0 2 1 9 7 8
2 1 1 2 3 4 6
3 9 8 7 6 5 4
For this new variable I would like it to generate it as such:
id max_v
1 v3
2 v5
3 v1
My current problem is that the roxmax is returning just the numeric maximum for each observation rather than which variable within my list of variables is the maximum. Any and all help would be amazing.
Related Posts with Generating a new variable that is the variable with the max value from rowmax
F-Test or T-TestHi guys, I have a question that is not regarding to Stata particually but to statistics in general.…
Comparing and assessing the fit of SUR models in StataI have two SUR models for which I want to assess the fit. I understand there is controversy as to wh…
Panel Data - Create variable that sums neighbors into group variableHello Experts, I am using country-year panel data using all countries from 1998-2017 with 3772 obser…
Survival analysis, discrete time - question on the model set up and goodness of fitHello Statalisters, I am trying to teach myself survival analysis estimation in STATA and at the mo…
Interpret coefficients measured in percent on binary dependent variable in panelHello Statalist members, reading in the forum has helped me at lot in the last weeks, but I cannot …
Subscribe to:
Post Comments (Atom)
0 Response to Generating a new variable that is the variable with the max value from rowmax
Post a Comment