Hi everyone, I need some help with a code.
I try to simplify. Let's consider 2 numeric variables (A and B). I want to generate a dummy variable C = 1 when for the same value of A, the observed individual assumed the maximum value of B, and 0 otherwise.
How can I translate this problem in Stata language?
Ex.
A B C
1 4 0
1 7 0
1 8 1
2 6 1
2 2 0
2 3 0
3 1 0
3 5 1
3 0 0
Can you help me?
Thanks in advance!
Related Posts with Create a dummy variable with a particular condition
OLS R^2 for large datasets inaccurate (lassogof)Dear community, I am using 'lassogof' to compare the performance of different Lasso, Elastic Net an…
Oaxaca decomposition detail unexplained partI am doing Oaxaca decomposition in detail. The interpretation of the explained part of different var…
Race and age composition for 50 states in multiple yearsI'm working with ACS data where I'm gonna need state controls like - income per capita , unemploymen…
Interpreting turning poingHello, I have calculated the turning points of my models, but in one of them i first differenced som…
Flipping (renaming) a stringHello, I have a series of varnames named year2010A | year2010B | ... | year2011A | year2011B | ... …
Subscribe to:
Post Comments (Atom)
0 Response to Create a dummy variable with a particular condition
Post a Comment