Re: Merging Senegal KR files to PR files [message #24150 is a reply to message #24149] |
Fri, 04 March 2022 07:18 |
Bridgette-DHS
Messages: 3202 Registered: February 2013
|
Senior Member |
|
|
Following is a response from DHS Research & Data Analysis Director, Tom Pullum:
You have made an interesting discovery. It happens that there are two duplicated children in the KR file, specifically those with b16=6 and 7 in the household with v001=43 and v002=14.
Your Stata code was correct. When you get the kind of message you got, with "merge 1:1", you can change to an older and more flexible version of the command, just "merge". I won't go into all the steps I used, but I found that the duplicates were in the KR file, not the PR file, and then ran these lines in the KR file:
sort v001 v002 b16
egen dup=seq() if b16~=0 & b16~=., by(v001 v002 b16)
tab dup,m
You can then list v001 v002 b16 for the cases with dup=2.
If you add two more lines:
Then you have a file with no duplicates and the 1:1 merge will work ok. I will report this and I hope eventually a corrected file will be issued. Thanks for discovering this issue! The problem was not with your code, but with the data file.
|
|
|