Sunday, July 7, 2019

Merging datasets

hello
i'm trying to merge two datasets but I'm not sure if what I'm trying to do (which is not working out) is even correct or possible.

I have a dataset measuring sexual violence in conflict and one which measures female combatants in conflict. I now want to add the variable that measures female combatants in conflict to the dataset of sexual violence.

i tried merging them by the common variables country, and conflict duration but stata tells me that " variables conflictdur country do not uniquely identify observations in the master data
r(459)"

this is what i did so far:

use wood_thomasJPR_replication12.dta, clear

rename duration conflictdur

sort conflictdur country

save wood_thomasJPR_replication12.dta, replace
clear

***********

use Repl2_Cohen_Nordas_JCR.dta

sort conflictdur country

save Repl2_Cohen_Nordas_JCR.dta, replace
clear

***********

use Repl2_Cohen_Nordas_JCR.dta, clear

merge 1:1 conflictdur country using wood_thomasJPR_replication12.dta, keepusing(female_combat_binary) keep(match master)
drop _merge


I'm actually just interested in adding the variable "female_combat_binary" to the "Repl2_Cohen_Nordas_JCR.dta" dataset.

Thanks for your help!!

No comments:

Post a Comment