* this code assumes that one is already in the directory data_generation/datasources/Political_vars/PolityIV

import excel http://www.systemicpeace.org/inscr/p4v2014.xls, firstrow clear // the paper used the 2011 version of this Excel file, which is no longer available online. Concerns 35 country-year observations with changes
keep  scode country year polity
drop if year<1960
drop if scode=="SDN" // there is one stray observation with this code in the data, which otherwise codes Sudan as "SUD"
replace polity=. if polity<-10 // this eliminates the codes -66, -77, and -88 (foreign interruption, interregnum, and transition, respectively)
label variable polity `"Polity IV score, transition/occupation/interregnum set to missing"'
merge m:1 scode using PolityIV_matchfile.dta, keepusing(ISO3code countryname) keep(1 3) nogenerate
drop if mi(ISO3code) // this affects only North and South Yemen before unification
replace ISO3code="SCG" if country=="Serbia and Montenegro" // these had code "YGS" in the original data, which denotes Yugoslavia
duplicates drop ISO3code year, force // Yugoslavia (1991, YGS and YUG, -5) and Ethiopia (1993, ETH and ETI, -88) show up twice in the data in times of transition with identical polity scores
drop scode country
order ISO3code countryname year polity
save polity_forexport
