Hello,
There are four regions (Area Unit), and four people.
The first table is the origin-destination matrix, which is the probabilities that a mover who started in the origin will end in the destination. The second table cumulates the values in each column of the first table.
Table 1
Origin AU
Destination 11 12 13 14
NULL 0.00 0.00 0.00 0.00
11 0.00 0.28 0.09 0.07
12 0.34 0.00 0.24 0.19
13 0.22 0.31 0.00 0.55
14 0.10 0.14 0.37 0.00
Outside 0.34 0.27 0.30 0.19
Table 2
Origin AU
Destination AU 11 12 13 14
NULL 0.00 0.00 0.00 0.00
11 0.00 0.28 0.09 0.07
12 0.34 0.28 0.33 0.26
13 0.56 0.59 0.33 0.81
14 0.66 0.73 0.70 0.81
Outside 1.00 1.00 1.00 1.00
The table at the bottom tracks what happens to the four people. It omits the first step, where we identify which people are movers. It simply jumps to the step where person #2 and #3 are movers, and the other two are stayers. It then looks up, for the movers, where they move to, using the random number in the fourth column.
Table 3
Old AU New AU Random Number New AU (after movers) {Result}
Person 1 11 11 0.795571004 11
Person 2 12 0 0.955491993 Outside
Person 3 13 0 0.018467159 11
Person 4 14 14 0.030028737 14
I am using the IF(C16=0,INDEX($G$5:$G$10,MATCH(D16,$I$5:$I$10)+1) ,B16) function in Excel. I want to know if there is a way in Stata I can do it. The Second table has the range of values that I specify as G and I. I am attaching a snapshot of the excel spreadsheet that I have.
Any help will be appreciated,
Thank you Array
0 Response to Vlookup in Stata
Post a Comment