[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: a question about merge
Dear Stata support,
I have a question on merging two datasets.
Assume that I have two datasets as followings:
Master dataset is named "file1" and contains two variables:
The using dataset is named "file2: and also contains two variables:
I would like to merge these two files. I expect to get a new file
(file3) as followings:
ID var1 var2
A 1 4
A 1 5
A 1 6
A 2 4
A 2 5
A 2 6
B 3 .
However, after I sort both datasets by ID and then type command:
merge ID using file2.dta
The resulted file is not what I expected.
I was wondering why this happens? Can I use merge command to obtain the
file3? Thanks a lot,
* For searches and help try: