Hello,
I would like to generate new variable by choosing a small value between two existing variables. For example, given that there exists two variables, A and B, I would like to generate new variable C by selecting smaller values between A and B.
Year A B C
1990 1 3 1
1991 2 -1 -1
1992 0 2 0
1993 -1 -3 -3
I tried to search "if else" command using "gen" command, but I could not find a proper solution to solve this problem.
Due to different signs of each value, subtracting or summing does not help to discern which value is larger or smaller.
Any advice and tip would be helpful!
Thank you
Related Posts with Create new variable based small value among two existing variables
Student and Subject Fixed effectsHi, I am running a panel data with 3000 observations and each student has two subjects recorded. I…
Extended regression models versus GMM model.I considered both extended regression models (ERMs) and GMM can tackle with endogeneity, but what di…
pert distributionhello i would like to know how to generate a PERT distribution from a low, high, and mean value say …
Oceania Stata Conference 2019We are pleased to announce that the Scientific Committee for the Oceania Stata Conference 2019 is no…
Restrictions to parametersI can't figure out how i should put restriction to a parameter. I want to measure a group within dif…
Subscribe to:
Post Comments (Atom)
0 Response to Create new variable based small value among two existing variables
Post a Comment