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
Calculating common ownership based on a formula with multiple summationsDear all, Assume that we have a dataset that has the following form: Code: input firm_id year …
Loops within weeklong periodHello Statalist. Happy New Year. This post is an extension of a previous post of mine that I've yet…
Correlation of one variable between players in panel dataHi all, I am working with a panel dataset regarding financial products. The dataset has about 200,0…
Stationarity from effective federal funds rate (DFF) from FREDHello, First of all, I wish you a happy new year. I am using the effective federal funds rate in p…
Want to regress institutions and some qualitative variables on GDPI want to regress institutions and some qualitative variables on GDP, I know that institutions varia…
Subscribe to:
Post Comments (Atom)
0 Response to Create a dummy variable with a particular condition
Post a Comment