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
Dealing with id problems in panel data Hello, I am using a person-firm-level panel data for analysis of wage differentials. But I found th…
How would I create this graph?I am very rusty with STATA and need some help with creating this graph shown in the image. What woul…
Predicting probability of a multivalued endogenous treatmentI am trying to figure out how to predict probability of participating in different treatments (or mu…
DeletedDeleted …
Finding minimum value out of 5 different variables for each rowI would like to create a new variable that equals the minimum value out of 5 different variables for…
Subscribe to:
Post Comments (Atom)
0 Response to Create new variable based small value among two existing variables
Post a Comment