Hello, I need help merging some survey data.
I have the following dataset: household-level data (farminghouseholds), mapping data (00_mapping_hh_com.dta), and a couple of community-level datasets, such as 1_Identification_ano.dta, 2_Respondents_ano, 3_c2q6_Electricity_ano, 4_c2c_Market_Access_ano, 5_c2d_input_support_ano. I use the following codes for merging.
data.use FarmingHouseholds.dta, clear
merge 1:1 HHID using "00_mapping_hh_com.dta", keep(match) nogen
order COMID, after(HHID)
drop if missing(COMID)
merge m:1 COMID using "1_Identification_ano.dta", keep(master match) nogen
However, as I continue to merge I receive errors when I try to merge. I am not sure what do clean in the data to make this work.
merge m:1 COMID using "3_c2q6_Electricity_ano.dta", keep(master match) nogen
merge m:1 COMID using "4_c2c_Market_Access_ano.dta", keep(master match) nogen
merge m:1 COMID using "5_c2d_input_support_ano.dta", keep(master match) nogen
merge m:1 COMID using "6_c2e_conflicts_ano.dta", keep(master match) nogen
merge m:1 COMID using "7_c4b_Disaster_ano.dta"", keep(master match) nogen
isid COMID is not unique among these variables. Is there a way around this?
Thank you
Nick Cox
Clyde Schechter
I have the following dataset: household-level data (farminghouseholds), mapping data (00_mapping_hh_com.dta), and a couple of community-level datasets, such as 1_Identification_ano.dta, 2_Respondents_ano, 3_c2q6_Electricity_ano, 4_c2c_Market_Access_ano, 5_c2d_input_support_ano. I use the following codes for merging.
data.use FarmingHouseholds.dta, clear
merge 1:1 HHID using "00_mapping_hh_com.dta", keep(match) nogen
order COMID, after(HHID)
drop if missing(COMID)
merge m:1 COMID using "1_Identification_ano.dta", keep(master match) nogen
However, as I continue to merge I receive errors when I try to merge. I am not sure what do clean in the data to make this work.
merge m:1 COMID using "3_c2q6_Electricity_ano.dta", keep(master match) nogen
merge m:1 COMID using "4_c2c_Market_Access_ano.dta", keep(master match) nogen
merge m:1 COMID using "5_c2d_input_support_ano.dta", keep(master match) nogen
merge m:1 COMID using "6_c2e_conflicts_ano.dta", keep(master match) nogen
merge m:1 COMID using "7_c4b_Disaster_ano.dta"", keep(master match) nogen
isid COMID is not unique among these variables. Is there a way around this?
Thank you
Nick Cox
Clyde Schechter
Comment