/* Working with ACD event data for Internal Armed Conflict. Data downloaded 25 January 2016 from https://www.prio.org/Global/upload/CSCW/Data/UCDP/2009/Main%20Conflict%20Table.xls */ version 14.1 clear all set more off import excel "Main Conflict Table.xls", sheet("Blad1") firstrow case(preserve) /* NOTE: Use of lowercase variable names in import results in error: "int invalid varname". NOTE DATES: Summarizing the date variables looks "wrong" because of their EXCEL formatting. However, if you 'browse' these variables, you will see that they are in mm/dd/yyyy format. The initial unit of observation is the conflict-year. */ * Clean up strings that are actually numbers: tab SideA if strpos(GWNOA, ",") tab SideB if strpos(GWNOB, ",") tab Location if strpos(GWNOLoc, ",") /* The above just identified which variables we want to clean up. The steps below required separate out these grouped values into their own observations. The 'replace' commands required running the DO-file up to them and knowing what the maximum seq_* values were. NOTE: The steps below leave SideA, etc., as string variables that are occassionally lists. */ gen count_GWNOA = wordcount(GWNOA) expand count_GWNOA if count_GWNOA>1 split GWNOA if count_GWNOA>1, parse(",") generate(split_GWNOA) egen seq_GWNOA = seq() if count_GWNOA>1, by(ID YEAR) replace GWNOA = split_GWNOA1 if seq_GWNOA==1 replace GWNOA = split_GWNOA2 if seq_GWNOA==2 replace GWNOA = split_GWNOA3 if seq_GWNOA==3 destring GWNOA, replace /* At this point, the unit of analysis is the conflict-countryA-year with the exception of dealing with Hyderabad as a country. For internal armed conflict (i.e., Type==3 & Type==4), this is a good place to stop cleaning strings. */ /* * If you were interested in constructing international dyads: gen count_GWNOB = wordcount(GWNOB) expand count_GWNOB if count_GWNOB>1 split GWNOB if count_GWNOB>1, parse(",") generate(split_GWNOB) egen seq_GWNOB = seq() if count_GWNOB>1, by(ID YEAR) replace GWNOB = split_GWNOB1 if seq_GWNOB==1 replace GWNOB = split_GWNOB2 if seq_GWNOB==2 replace GWNOB = split_GWNOB3 if seq_GWNOB==3 replace GWNOB = split_GWNOB4 if seq_GWNOB==4 replace GWNOB = split_GWNOB5 if seq_GWNOB==5 destring GWNOB, replace */ drop count_* seq_* split_* * Clean up missing value codes: recode EpEndPrec GWNOA (-99=.) drop if Type<3 drop if GWNOA==. // Eliminates conflict involving "non-state" Hyderabad. * Identify unit of analysis: isid ID GWNOA YEAR /* The unit of analysis for this data set is the conflict-country-year */