How can I merge two data sets when the using data set is a subset of the master data set? Stata

Viewed 18

I have three data sets I would like to merge: one contains data on all members of a household and the other two contain more detailed data on women and men respectively.

I would like to link my detailed data to the household data. See an example of the data sets below. I need to use household ID (HH ID) and individual ID (IND ID) to link to bolded observations. Once the women and men data are merged there will still be some missing observations that do appear in the household data (which I would like to keep).

Household data set

HH ID IND ID
1 1
1 2
1 3
1 4
2 1
2 2
2 3
3 1

Women's data set

HH ID IND ID
1 1
1 3
2 2
3 1

I have tried the following 1:1 merge

merge 1:1 hhid indid using "womens_data.dta"

and got the following error message,

variables hhid indid do not uniquely identify observations in the master data
r(459);

What should I be doing instead?

0 Answers
Related