To use -merge-, the two datasets SHOULD be unique and sorted by an index variable. In your stituation, I guess,
index var1
1 14
2 18
3 23
Index var2
1 10
1 12
2 2
2 4
....
For the non-unique dataset, you are supposedto FIRSLTY know WHY YOU ARE MERGING THEM. To generate a unique dataset, you may use -collapse- or -reshape- to calculate the mean, sum, median . . . .. Then merge the two after sorting.
Lastly, one suggestion for those raising questions: describe your question(s) with example rather than just throwing questions out. The more detailed, the more likely people help you out.