Hi all,
I have a question regarding random selection.
I want to create a new variable Z, which is chosen from the existing variable C. The condition is that the range for the selection of A is with the same D variable. However, the C variable is dummy 0 and 1.
For example, the data is:
ID A B C D
1 0 0.1 0 1
2 9 0.3 0 3
3 8 0.4 1 2
4 10 0.6 1 2
5 10 0.8 0 1
6 8 0.3 1 1
7 10 0.3 0 3
8 6 0.5 1 3
For ID=1, Z variable will be selected from the same D variable, which is from ID=5 or ID=6. Therefore, either the C value of the 5th or 6th observation will be the final value for the Z variable. The selection is totally random.
Please help me out of the Stata codes.
Thanks in advance
Related Posts with Random Selection
Referring to the group variable in ml evaluatorAccording to the manual https://www.stata.com/manuals/rml.pdf, ml accepts a model option group(varna…
Margins at the median and all the other variables at zero levelHello people, I have run my LOGIT regression and now I want to obtain the marginal effect at the me…
Graphing svy tabulation results including 95% confidence intervalsHello all, I frequently find that I want to produce line graphs of times series of categorical vari…
Need to calculate age (in years)Hi All, I hope I explain this clearly and with enough information, please let me know if I can prov…
Restrict household with children age 7-23Hello all, i am currently doing my thesis using the data from IFLS. i want to estimate the effect of…
Subscribe to:
Post Comments (Atom)
0 Response to Random Selection
Post a Comment