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
Margins and Predict for Tobit estimationI have a question regarding the following error message: missing predicted values encountered within…
Performing a Backward Hierarchical Stepwise Selection on Multiple Imputed DataHi can someone help me figure out how to perform this in Stata 15? I looked for possible solutions a…
Setting significant levels and explanationHi everyone, I am new to the forum. My original paper shows that " *, ** and *** denote significanc…
Observations for the same ID on multiple lines Code: * Example generated by -dataex-. To install: ssc install dataex clear input str33 country flo…
grqreg xlabel and ylabelHello there, I am facing a problem when using the xlabel and ylabel in grqreg in STATA Quantile Reg…
Subscribe to:
Post Comments (Atom)
0 Response to Create a dummy variable with a particular condition
Post a Comment