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
mediation with threshold modelDear all i hope you are doing well i'd like to ask you if there is a way to deal with mediation ef…
labels of yDear All, I have this dataset Code: * Example generated by -dataex-. To install: ssc install dataex…
Mediation with quantile regressionDear all i hope you are doing well i'd like to ask you if there is a way to deal with mediation ef…
Covariances across groups and quarters Code: * Example generated by -dataex-. To install: ssc install dataex clear input byte qrtr float(…
Help with Loop based on timeHi For the following dataset, I have generated the first month of the data for X2 and X3 but for re…
Subscribe to:
Post Comments (Atom)
0 Response to Create a dummy variable with a particular condition
Post a Comment