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
regress rob, regression model with robust std. errorsDear community! I have a model with the violation the assumption about homoscedasticity. So first i…
Modified Poisson Regression using GLM: missing categoriesI want to know the effect of selected background characteristics on intimate partner violence among …
xtlsdvc model comparisonHi! I am running two models using xtlsdvc. The second model includes one additional explanatory va…
ttest multiple variableDear All, I want to perform a simple ttest to compare multiple variables by gender. i have tried Co…
Create a variable based its proportionDear Stata Users, Please, help me with the following issue. I need to calculate reserves based on t…
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