**............................................................................** ** ** ** COMPARATIVE STUDY OF ELECTORAL SYSTEMS (CSES) ** ** Stata example syntax for bridging party-level data to CSES relational ** ** data: Bridging the CSES MODULE 4 FINAL RELEASE to the Comparative ** ** Manifesto Project Dataset (MARPOR/CMP) ** ** ** ** CSES Module 4 Version: MODULE 4 FINAL RELEASE ** ** MARPOR/CMP Version: Manifesto Project Dataset (Version 2020a) ** ** Default Directory: c:\cses\CSES_data_bridging_project ** ** ** ** Website: www.cses.org ** ** Email: cses@umich.edu ** ** Last Updated: November 23, 2020 ** ** Created by: CSES Secretariat ** **............................................................................** ******************************************************************************** ** PURPOSE OF SYNTAX FILE ******************************************************************************** ** This syntax file is intended for experienced users of STATA. For users ** who are less familiar with STATA, we recommend that you use the Comprehensive ** File which provides detailed comments for each command in the file. This is ** available on the CSES Data Bridging Webpage - see Comprehensive File. ** This syntax outlines how to bridge the 2020a MARPOR/CMP Manifesto Project ** Dataset to the CSES Module 4 Final Release dataset. ** The example demonstrates how to merge MARPOR/CMPs right-left ideological ** index (variable name in MARPOR/CMP "RILE") to the CSES M4 ataset. ** Variables from MARPOR/CMP can also be linked to other CSES Data Products ** using this syntax example be specifying a different CSES data product. ** Other variables from MARPOR/CMP besides the "RILE" can also be linked to CSES ** data products by specifying a different variable from MARPOR/CMP. ** ACHTUNG: Before running the file, download the datasets and save them in the ** working directory: ** The current release of the CSES Module 4 Dataset is available via ** https://cses.org/data-download/module-4-2011-2016/ ** The current release of the Manifesto Project Dataset (version 2020a) is ** available via https://manifesto-project.wzb.eu/datasets upon registration. ******************************************************************************** **#>>> 1: SETTING-UP STATA ******************************************************************************** clear all capture log close cd "C:\cses\CSES_data_bridging_project" ** ACHTUNG: Running the syntax requires the CSES IMD and MARPOR/CMP datasets ** to be placed in the working directory specified above. ******************************************************************************** **#>>> 2: LOADING THE CSES MODULE 4 DATASET & PREPARING CSES MODULE 4 DATASET ** FOR MERGING WITH VARIABLES FROM MARPOR/CMP ******************************************************************************** use cses4.dta, clear * polity and PARTY A-I IDs: tabulate D1006_NAM, m tab1 D5200_*, m * election year ID (YYYYMM format required by MARPOR/CMP): * election month: tostring D5024_1, gen(emonth) replace emonth = "01" if emonth == "1" replace emonth = "02" if emonth == "2" replace emonth = "03" if emonth == "3" replace emonth = "04" if emonth == "4" replace emonth = "05" if emonth == "5" replace emonth = "06" if emonth == "6" replace emonth = "07" if emonth == "7" replace emonth = "08" if emonth == "8" replace emonth = "09" if emonth == "9" *election year: tostring D5024_3, gen(eyear) *combining year + month: generate date = eyear + emonth destring date, replace tabulate date, m drop emonth eyear save cses_m4_formerging.dta, replace ******************************************************************************** **#>>> 3: LOADING THE MARPOR/CMP DATASET & PREPARING MARPOR/CMP DATASET ** FOR MERGING WITH CSES MODULE 4 ******************************************************************************** use "MPDataset_MPDS2020a.dta", clear *polity ID: generate D1006_NAM = countryname replace D1006_NAM = "United States of America" if D1006_NAM == "United States" replace D1006_NAM = "Republic of Korea" if D1006_NAM == "South Korea" replace D1006_NAM = "Great Britain" if D1006_NAM == "United Kingdom" *election year ID: tabulate date, missing ** PARTY A-I IDs: generate D5200_A = party generate D5200_B = party generate D5200_C = party generate D5200_D = party generate D5200_E = party generate D5200_F = party generate D5200_G = party generate D5200_H = party generate D5200_I = party ** keep only needed variables / relevant time periods from MARPOR/CMP keep D1006_NAM date D5200* rile keep if inrange(date, 201101, 201612) save MPDataset_MPDS2020a_formerging, replace ******************************************************************************** ** #>>> 4: MERGING THE CSES MODULE 4 AND MARPOR/CMP DATASETS TOGETHER ******************************************************************************** use cses_m4_formerging.dta, clear ** PARTY A: merge m:1 D1006_NAM date D5200_A using "MPDataset_MPDS2020a_formerging.dta", gen(merge_A) rename rile rile_A label variable rile_A "MARPOR/CMP RIGHT-LEFT IDEOLOGICAL INDEX - PARTY A" drop if merge_A == 2 ** PARTY B: merge m:1 D1006_NAM date D5200_B using "MPDataset_MPDS2020a_formerging.dta", gen(merge_B) rename rile rile_B label variable rile_B "MARPOR/CMP RIGHT-LEFT IDEOLOGICAL INDEX - PARTY B" drop if merge_B == 2 ** PARTY C: merge m:1 D1006_NAM date D5200_C using "MPDataset_MPDS2020a_formerging.dta", gen(merge_C) rename rile rile_C label variable rile_C "MARPOR/CMP RIGHT-LEFT IDEOLOGICAL INDEX - PARTY C" drop if merge_C == 2 ** PARTY D: merge m:1 D1006_NAM date D5200_D using "MPDataset_MPDS2020a_formerging.dta", gen(merge_D) rename rile rile_D label variable rile_D "MARPOR/CMP RIGHT-LEFT IDEOLOGICAL INDEX - PARTY D" drop if merge_D == 2 ** PARTY E: merge m:1 D1006_NAM date D5200_E using "MPDataset_MPDS2020a_formerging.dta", gen(merge_E) rename rile rile_E label variable rile_E "MARPOR/CMP RIGHT-LEFT IDEOLOGICAL INDEX - PARTY E" drop if merge_E == 2 ** PARTY F: merge m:1 D1006_NAM date D5200_F using "MPDataset_MPDS2020a_formerging.dta", gen(merge_F) rename rile rile_F label variable rile_F "MARPOR/CMP RIGHT-LEFT IDEOLOGICAL INDEX - PARTY F" drop if merge_F == 2 ** PARTY G: merge m:1 D1006_NAM date D5200_G using "MPDataset_MPDS2020a_formerging.dta", gen(merge_G) rename rile rile_G label variable rile_G "MARPOR/CMP RIGHT-LEFT IDEOLOGICAL INDEX - PARTY G" drop if merge_G == 2 ** PARTY H: merge m:1 D1006_NAM date D5200_H using "MPDataset_MPDS2020a_formerging.dta", gen(merge_H) rename rile rile_H label variable rile_H "MARPOR/CMP RIGHT-LEFT IDEOLOGICAL INDEX - PARTY H" drop if merge_H == 2 ** PARTY I: merge m:1 D1006_NAM date D5200_I using "MPDataset_MPDS2020a_formerging.dta", gen(merge_I) rename rile rile_I label variable rile_I "MARPOR/CMP RIGHT-LEFT IDEOLOGICAL INDEX - PARTY I" drop if merge_I == 2 ******************************************************************************** * #>>> 5: FINALIZING THE BRIDGED DATASET ******************************************************************************** order rile*, after(D5201_I) drop date merge_* save cses4_MARPOR_rile.dta, replace ************************************************** *END OF DO-FILE