Dear All, J found this question here (in Chinese). Suppose that I have two datasets. Data A is:
and Data B is:
The desired result is
The rule is that (1) first merge A with B using id1 (1 and 2), and then (2) the remaining ones are merged using id2 (33). Any suggestions are appreciated.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(id1 id2 sells) 1 11 4 1 11 5 1 11 6 2 22 3 2 22 3 3 33 4 3 33 2 end
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(id1 id2 costs) 1 11 .2 2 . .3 . 33 .4 end
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(id1 id2 sells costs) 1 11 4 .2 1 11 5 .2 1 11 6 .2 2 22 3 .3 2 22 3 .3 3 33 4 .4 3 33 2 .4 end
Comment