* code assumes one is already in replicationfiles/data_generation/datasources/slavery (for merge)

* get population matrix from Putterman & Weil:

import excel using http://www.econ.brown.edu/fac/louis_putterman/matrix%20version%201p1.xls, clear firstrow

* keep only origin countries with non-zero slave exports (according to Nunn, 123 QJE (2008) t. 2 -- order here is by size, used for egen later):
keep wbcode wbname  ago nga gha eth sdn mli zar moz tza tcd ben sen gin tgo gnb bfa mrt mwi mdg cog ken sle cmr dza civ som zmb gab gmb ner lby lbr uga zaf caf egy zwe nam bdi gnq  bwa
order  wbcode wbname ago nga gha eth sdn mli zar moz tza tcd ben sen gin tgo gnb bfa mrt mwi mdg cog ken sle cmr dza civ som zmb gab gmb ner lby lbr uga zaf caf egy zwe nam bdi gnq  bwa

* calculate totals of (possible) slave descendents
egen		slave_total		= rowtotal(ago-bwa)
label var	slave_total			"descendants of slave-exporting African countries (%; source: Nunn & PW 1.1)"
egen 		slave_total1m	= rowtotal(ago-eth)
label var	slave_total1m		"same as slave_total, but only exporters > 1m slaves"
egen		slave_total500k	= rowtotal(ago-tcd)
label var	slave_total500k		"same as slave_total, but only exporters > 500k slaves"
egen		slave_total250k	= rowtotal(ago-tgo)
label var	slave_total250k		"same as slave_total, but only exporters > 250k slaves"


* get ready for merge
merge 1:1 wbcode wbname using slavery_ISO_africa.dta, nogenerate assert(3)
order ISO wb* africa slave*
keep  ISO wb* africa slave*
