Re: Merging women's file with Household File [message #1376 is a reply to message #1374] |
Wed, 19 February 2014 15:52  |
Trevor-DHS
Messages: 805 Registered: January 2013
|
Senior Member |
|
|
You don't need to create your variable unique. You can just sort the household data on v001 and v002:
sort v001 v002
Then for the women's data, you need to sort by these variables plus the woman's line number (v003), e.g.
sort v001 v002 v003
Next (and this is where your problem lies), merge the data using the following:
merge m:1 v001 v002 using "...", keep(match master)
In your version you had 1:m, but you need m:1 as you need to merge multiple women's variable with one household, not one woman with multiple households.
The keep option will keep cases that matched as well as those that were in the master file (the women's data), but did not have matching household data (there shouldn't be any of these, but it is better to do this way to ensure that you are not dropping any records from the women's data by accident).
I hope this will solve the problem for you.
|
|
|