Merging Senegal KR files to PR files [message #24149] |
Thu, 03 March 2022 15:29 ![Go to next message Go to previous message](/theme/default/images/down.png) |
tundexZ
Messages: 4 Registered: March 2022
|
Member |
|
|
Hi All,
I am trying to merge some mother characteristics from the KR file to the PR file for all DHS data available for Senegal. using PR as the base file. I have encountered a problem that many seem to have faced in this forum. I started with merging the 2019 dataset and I keep getting error messages "variables hv001 hv002 and hvidx do not uniquely identify the observations in the using data".
Sincerly have i tried to find and used the answers in the forum thread but I am stil getting the same error message
( https://userforum.dhsprogram.com/index.php?t=msg&goto=21 769&&srch=merging+KR+to+PR+file#msg_21769)
( https://userforum.dhsprogram.com/index.php?t=msg&goto=13 952&&srch=merging+KR+to+PR+file#msg_13952)
Here are my statacodes I used
**preparing kr file
use "C:\Users\owolba\Desktop\foodways project\Senegal DHS DAta\STATA DATASET SENEGAL\SNKR8BFL.DTA", clear
keep caseid v001 v002 b16 v131 v130 v704 v705 v716 v717 v732 v745b
rename v001 hv001
rename v002 hv002
rename b16 hvidx
drop if hvidx==0 | hvidx==.
sort hv001 hv002 hvidx`
save temp.dta, replace
**preparing pr file for merge
use "C:\Users\owolba\Desktop\foodways project\Senegal DHS DAta\STATA DATASET SENEGAL\SNPR8BFL.DTA",clear
sort hv001 hv002 hvidx
merge 1:1 hv001 hv002 hvidx using temp.dta
I have tried this codes and all other suggestions but i still get get the error code: "variables hv001 hv002 hvidx do not uniquely identify observations in the using data"
Thank you in anticipation for your response
Regards,
Babs
|
|
|