I would like to create a new variable which takes the minimum value in each row, (ignoring the zeros). How do you do this?
I tried this below and it didnt work
foreach var of varlist ethos_1rough ethos_2emerg ethos_3temp ethos_5immigrant {
egen higher_ethos = rowmin(`var') if `var' ~=0
}
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(ethos_1rough ethos_2emerg ethos_3temp ethos_5immigrant)
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 2 3 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 3 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 3 0
0 0 3 0
0 0 3 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
1 0 0 0
1 0 0 0
1 0 0 0
0 0 0 0
end
[/CODE]
Related Posts with rowmin
Difference in Differences with 3 time periodsDear all, I am currently analyzing the link between board gender diversity and firm performance. I …
Forloop to import multiple .sav files not workingHello all, would appreciate an advise on how i can fix the following line of commands to import/read…
Multiple linear regression helpHi I am currently running multiple linear regression analyses. The predictor variables that I am…
Time-series dataset with repeated valuesDear community! I am conducting a research on public opinion combined with different survey rounds, …
forest plot for ST Cox HRHi! I`d like to build a forestplot of my stcox HR for many variables. I tried with ipdover, over (va…
Subscribe to:
Post Comments (Atom)
0 Response to rowmin
Post a Comment