Hi all,

Thanks in advance for any suggestions and supports!
I am currently trying to expand a dataset and insert values to existing variables in the expanded dataset from another dataset. The following tables represent the problem.

Original Data: D1 - the dataset is to be expanded
Firm Year Focal Event_id
1 1990 a 1
1 1990 b 2
1 1991 c 3
2 2000 d 4
2 2001 e 5
Merging data: D2 - the dataset where the value will be added to D1
Firm Year Focal_1
1 1990 x
1 1990 y
1 1991 x
1 1991 y
1 1991 z
2 2000 w
2 2000 v
2 2001 w
2 2001 v
Resulting table
Firm Year Focal Event_id
1 1990 a 1
1 1990 x 1
1 1990 y 1
1 1990 b 2
1 1990 x 2
1 1990 y 2
1 1991 c 3
1 1991 x 3
1 1991 y 3
1 1991 z 3
2 2000 d 4
2 2000 w 4
2 2000 v 4
2 2001 e 5
2 2001 w 5
2 2001 v 5
Currently, I have managed to expand D1 using the expand command, but I am stuck on the merging process.
My dataset is too big (the D1 has more than 9 million after expansion) so the system memory is not enough for the joinby command. Could you give me some idea of how to do this efficiently?
I would appreciate any advice. Thanks!