========== ./Fuentes de Datos/Dipres/SP Dipres.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: Gráficos evolución presupuestos SP Dipres Author: Raúl Fugellie Date: May 11, 2023 Version: Stata 17 Summary: *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "raulfugellie"{ global path "/Users/raulfugellie/Dropbox/Seguridad Pública/Fuentes de Datos" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global Carabineros "$path/Dipres/Carabineros" global Defensoria "$path/Dipres/Defensoría Penal Pública" global Formacion "$path/Dipres/Formación y Perfeccionamiento policial" global Gendarmeria "$path/Dipres/Gendarmería" global MP "$path/Dipres/Ministerio Público" global PDI "$path/Dipres/PDI" global SML "$path/Dipres/SML" global usedata "$path/Dipres/Data consolidada" global graphs "$path/Dipres/Tablas y gráficos" ************************************************************* ========== ./Fuentes de Datos/Latinobarómetro/Para trabajar latinobarometro 2018.do ========== *Jorge Guzman * Latinobarometro para Lucas *jlguzman88@gmail.com *Fecha 1 de marzo del 2023 clear all set more off cd "C:\Users\jguzman4\Desktop\Lucas" dir ******************************************************** *Importamos la base import excel latinobarometro.xlsx, clear foreach var of varlist A-OE { replace `var'=subinstr(`var',".","",.) } foreach v of varlist * { local vname = strtoname(`v'[1]) rename `v' `vname' } drop in 1 saveold latinobariometro, replace ========== ./Seguridad P£blica/02 Code/01 Cleaning Data, ENUSC 16-21.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Cleaning Data, ENUSC 16-21 Author: Lucas García Date: November 11, 2022 Version: Stata 17 Summary: This dofile sets the data to check different tendencies of the different common variables between the ENUSC surveys of 2016 to 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Enusc 16 21" global tables "$path/06 Tables" ************************************************ * 1. Cleaning data * ************************************************ ========== ./Seguridad P£blica/02 Code/Informe 1/00 Master Do file, Informe 1.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 00 Master Do file, Informe 1 Author: Lucas García Date: December 13, 2022 Version: Stata 17 Summary: This dofile prepares the data to plot each one of the Figures of the article "Informe de Seguridad Pública: Tendencias recientes en crimen". To be used, you must check the address of each dofile called and of each folder where the figures are saved. *******************************************************************************/ clear all ************************************************* * 0. Key Macros * ************************************************* *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" version 17.0 ****************************************************** ========== ./Seguridad P£blica/02 Code/Informe 1/01 Clean data, INE projections.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Clean data, INE projections Author: Lucas García Date: November 29, 2022 Version: Stata 17 Summary: This dofile sets the population projections from INE for each region from 2002 to 2035. It keeps jist 2016-2022 *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Cleaning data * ************************************************ *00 Open DB import delimited using "$rawdata/ine_estimaciones-y-proyecciones-2002-2035_base-2017_region_base", clear ========== ./Seguridad P£blica/02 Code/Informe 1/01 Cleaning Data, ENUSC 08-15, incomplete.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Cleaning Data, ENUSC 08-15, incomplete Author: Lucas García Date: December 02, 2022 Version: Stata 17 Summary: This dofile sets the data to check different tendencies of the different common variables between the ENUSC surveys of 2008 to 2015. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Enusc 08 15" global tables "$path/06 Tables" ************************************************ * 1. Cleaning data * ************************************************ ========== ./Seguridad P£blica/02 Code/Informe 1/01 Cleaning Data, ENUSC 08-21.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Trends Long Term, ENUSC 08-21 Author: Lucas García Date: November 11, 2022 Version: Stata 17 Summary: This dofile plots the trends of perception of delinquency, victimization and revictimization from 2008 to 2021 using the interanual ENUSC data base. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Enusc 08 21" global tables "$path/06 Tables" ************************************************ * 1. Preparing data * ************************************************ *00 Opening DB ========== ./Seguridad P£blica/02 Code/Informe 1/01 Cleaning Data, ENUSC 16-21.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Cleaning Data, ENUSC 16-21 Author: Lucas García Date: November 11, 2022 Version: Stata 17 Summary: This dofile sets the data to check different tendencies of the different common variables between the ENUSC surveys of 2016 to 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Enusc 16 21" global tables "$path/06 Tables" ************************************************ * 1. Cleaning data * ************************************************ ========== ./Seguridad P£blica/02 Code/Informe 1/01 Corr delta(perc-vict) - delta(homicides).do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Corr delta(perc-vict) - delta(homicides) Author: Lucas García Date: November 29, 2022 Version: Stata 17 Summary: This dofile plots the correlation between the delta of 2022 with 2016 of the difference between individual perception and individual victimization, against the delta of region level homicides. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Data of ENUSC * ************************************************ ******* 2016-2021 ========== ./Seguridad P£blica/02 Code/Informe 1/01 DEIS.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Homicides trends, Minsal Author: Lucas García Date: November 20, 2022 Version: Stata 17 Summary: This dofile plots gun shot deaths trends using data from Health Ministery. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Data * ************************************************ *00 Open DB import delimited using "$rawdata/DEFUNCIONES_FUENTE_DEIS_2016_2022_10112022", clear ========== ./Seguridad P£blica/02 Code/Informe 1/01 DMCS Cead y ENUSC.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 DMCS Cead y ENUSC Author: Lucas García Date: December 09, 2022 Version: Stata 17 Summary: This dofile sets the data as survey data and plots the trends of biggest social connotation crimes from CEAD and from ENUSC. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Preparing data * ************************************************ *00 Opening DB ========== ./Seguridad P£blica/02 Code/Informe 1/01 Homicides trends, CEAD, Fiscal¡a y DEIS.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Homicides trends, CEAD, Fiscalía y DEIS Author: Lucas García Date: November 22, 2022 Version: Stata 17 Summary: This dofile plots homicides trends using data from CEAD and from Fiscalia *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Data 16-21 CEAD y Fiscalia * ************************************************ *00 Opening 2016-2021 dataset use "$usedata/cead" ========== ./Seguridad P£blica/02 Code/Informe 1/01 Homicides trends, CEAD y Fiscal¡a.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Homicides trends, CEAD y Fiscalía Author: Lucas García Date: November 22, 2022 Version: Stata 17 Summary: This dofile plots homicides trends using data from CEAD and from Fiscalia *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Data 16-21 CEAD y Fiscalia * ************************************************ *00 Opening 2016-2021 dataset use "$usedata/cead" ========== ./Seguridad P£blica/02 Code/Informe 1/01 Homicides trends, CEAD.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Homicides trends, CEAD Author: Lucas García Date: November 21, 2022 Version: Stata 17 Summary: This dofile plots homicides trends using data from CEAD. It plots the trend of all homicides from 2016 to 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Data 16-21, * ************************************************ *00 Opening 2016-2021 dataset and merge with ine projections import excel using "$rawdata/reportesEstadisticos-unidadTerritorial, CEAD", firstr sh("Hoja1") ========== ./Seguridad P£blica/02 Code/Informe 1/01 Homicides trends, Fiscal¡a.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Homicides trends, Fiscalía Author: Lucas García Date: November 20, 2022 Version: Stata 17 Summary: This dofile plots homicides trends using data from Fiscalia. First it plots the trend of all homicides from 2016 to 2021 and then just the cumulative homicides from january to december from 2016 to 2022. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Data 16-21 * ************************************************ ========== ./Seguridad P£blica/02 Code/Informe 1/01 How people inform, ENUSC 16-21.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 How people inform, ENUSC Author: Lucas García Date: November 11, 2022 Version: Stata 17 Summary: This dofile plots a bar graph woth how people inform using enusc 2016, 2017, 2017, 2019 & 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Preparing data, 2021 * ************************************************ *00 Opening DB use "$usedata/enusc_16_21", clear ========== ./Seguridad P£blica/02 Code/Informe 1/01 Theft trends, Fiscal¡a.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Theft trends, Fiscalía Author: Lucas García Date: November 20, 2022 Version: Stata 17 Summary: This dofile plots theft trends using data from Fiscalia. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Data 16-21 * ************************************************ *Use Ine projections and Collapse to keep relevant info use "$usedata/ine_projections_16_22", clear ========== ./Seguridad P£blica/02 Code/Informe 1/02 Tendencias de las variables, ENUSC 16-21.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 02 Tendencias de las variables Author: Lucas García Date: November 17, 2022 Version: Stata 17 Summary: This dofile sets the data as survey data and plots the trends of different variables: The victimization *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Defining data as survey * ************************************************ *00 Open Database ========== ./Seguridad P£blica/02 Code/Informe 2/01 CADEM Trust trends.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 CADEM Trust trends Author: Lucas García Date: February 28, 2023 Version: Stata 17 Summary: This dofile plots institutional trust trends from 2015 til 2023, for different periodicity and institutions. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning DB * ************************************************ *00 Opening 2016-2022 dataset import excel using "$rawdata/Cadem, evolutivo evaluación Instituciones", firstr clear sheet("Serie") ========== ./Seguridad P£blica/02 Code/Informe 2/01 CEP Trust trends.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 CEP Trust trends Author: Lucas García Date: February 28, 2023 Version: Stata 17 Summary: This dofile plots institutional trust trends from 2015 til 2023, for different periodicity and institutions. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning DB * ************************************************ *00 Opening CEP historic dataset use "$rawdata/base_consolidada_2000_2022_v2 CEP.dta", clear ========== ./Seguridad P£blica/02 Code/Informe 2/01 Congress LAC Comparison, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Congress LAC Comparison, multiple DB, Plots Author: Lucas García Date: March 07, 2023 Version: Stata 17 Summary: This dofile plots Congress trust trends using 2 different data sources: Latinobarometro and LAPOP. It compares LAC and Chile *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 2. Latinobarometro * ************************************************ *00 Defining temporal file to fill and plot ========== ./Seguridad P£blica/02 Code/Informe 2/01 Congress trust, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Congress trust, multiple DB, Plots Author: Lucas García Date: March 07, 2023 Version: Stata 17 Summary: This dofile plots Congress trust trends using 3 different data sources: CEP, Latinobarometro and LAPOP. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Setting temporal file & Opening CEP DB * ************************************************ *00 Defining temporal file to fill and plot ========== ./Seguridad P£blica/02 Code/Informe 2/01 Elections LAC Comparison, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Elections LAC Comparison, multiple DB, Plots Author: Lucas García Date: March 07, 2023 Version: Stata 17 Summary: This dofile plots Electoral institutions trust trends using 2 different data sources: Latinobarometro and LAPOP. It compares LAC and Chile *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 2. Latinobarometro * ************************************************ *00 Defining temporal file to fill and plot ========== ./Seguridad P£blica/02 Code/Informe 2/01 ENUSC Variables.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 ENUSC Variables Author: Lucas García Date: March 03, 2023 Version: Stata 17 Summary: This dofile uses ENUSC Database in order to plot the trends of Police Trust from 2016 until 2019. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Defining data as survey * ************************************************ *00 Open Database ========== ./Seguridad P£blica/02 Code/Informe 2/01 Government trust, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Government trust, multiple DB, Plots Author: Lucas García Date: March 21, 2023 Version: Stata 17 Summary: This dofile plots Government trust trends using 3 different data sources: CEP, Latinobarometro and Bicentenario UC. It also plots Government's mark performance trend according to Paz Ciudadana. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Setting temporal file & Opening CEP DB * ************************************************ ========== ./Seguridad P£blica/02 Code/Informe 2/01 Justice LAC Comparison, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Justice LAC Comparison, multiple DB, Plots Author: Lucas García Date: March 07, 2023 Version: Stata 17 Summary: This dofile plots Justice trust trends using 2 different data sources: Latinobarometro, LAPOP. It compares LAC with Chile *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Setting temporal file * ************************************************ *00 Defining temporal file to fill and plot ========== ./Seguridad P£blica/02 Code/Informe 2/01 Justice trust, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Justice trust, multiple DB, Plots Author: Lucas García Date: March 02, 2023 Version: Stata 17 Summary: This dofile plots Justice trust trends using 4 different data sources: CEP, CADEM, Latinobarometro, LAPOP and WJP. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Setting temporal file & Opening CEP DB * ************************************************ *00 Defining temporal file to fill and plot ========== ./Seguridad P£blica/02 Code/Informe 2/01 LAPOP, Cleaning Chile.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 LAPOP, Cleaning Chile Author: Lucas García Date: February 28, 2023 Version: Stata 17 Summary: This dofile cleans Chilean LAPOP survey from 2010 until 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning 2021 DB * ************************************************ *00 Opening 2021 dataset, cleaning use "$rawdata/CHL_2021_LAPOP_AmericasBarometer_v1.2_w.dta", clear ========== ./Seguridad P£blica/02 Code/Informe 2/01 LAPOP, Cleaning Argentina.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 LAPOP, Cleaning Argentina Author: Lucas García Date: February 28, 2023 Version: Stata 17 Summary: This dofile cleans Argentina LAPOP survey from 2010 until 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning 2021 DB * ************************************************ *00 Opening 2021 dataset, cleaning use "$rawdata/ARG_2021_LAPOP_AmericasBarometer_v1.2_w.dta", clear ========== ./Seguridad P£blica/02 Code/Informe 2/01 LAPOP, Cleaning Bolivia.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 LAPOP, Cleaning Bolivia Author: Lucas García Date: February 28, 2023 Version: Stata 17 Summary: This dofile cleans Perú LAPOP survey from 2010 until 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning 2021 DB * ************************************************ *00 Opening 2021 dataset, cleaning use "$rawdata/BOL_2021_LAPOP_AmericasBarometer_v1.2_w.dta", clear ========== ./Seguridad P£blica/02 Code/Informe 2/01 LAPOP, Cleaning Brazil.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 LAPOP, Cleaning Brazil Author: Lucas García Date: March 02, 2023 Version: Stata 17 Summary: This dofile cleans Brazil LAPOP survey from 2010 until 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning 2021 DB * ************************************************ *00 Opening 2021 dataset, cleaning use "$rawdata/BRA_2021_LAPOP_AmericasBarometer_v1.2_w.dta", clear ========== ./Seguridad P£blica/02 Code/Informe 2/01 LAPOP, Cleaning Colombia.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 LAPOP, Cleaning Colombia Author: Lucas García Date: February 28, 2023 Version: Stata 17 Summary: This dofile cleans Colombia LAPOP survey from 2010 until 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning 2021 DB * ************************************************ *00 Opening 2021 dataset, cleaning use "$rawdata/COL_2021_LAPOP_AmericasBarometer_v1.2_w.dta", clear ========== ./Seguridad P£blica/02 Code/Informe 2/01 LAPOP, Cleaning Ecuador.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 LAPOP, Cleaning Ecuador Author: Lucas García Date: March 02, 2023 Version: Stata 17 Summary: This dofile cleans Ecuador LAPOP survey from 2010 until 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning 2021 DB * ************************************************ *00 Opening 2021 dataset, cleaning use "$rawdata/ECU_2021_LAPOP_AmericasBarometer_v1.2_w.dta", clear ========== ./Seguridad P£blica/02 Code/Informe 2/01 LAPOP, Cleaning Mexico.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 LAPOP, Cleaning Mexico Author: Lucas García Date: March 02, 2023 Version: Stata 17 Summary: This dofile cleans Mexico LAPOP survey from 2010 until 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning 2021 DB * ************************************************ *00 Opening 2021 dataset, cleaning use "$rawdata/MEX_2021_LAPOP_AmericasBarometer_v1.2_w.dta", clear ========== ./Seguridad P£blica/02 Code/Informe 2/01 LAPOP, Cleaning Paraguay.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 LAPOP, Cleaning Paraguay Author: Lucas García Date: March 02, 2023 Version: Stata 17 Summary: This dofile cleans Paraguay LAPOP survey from 2010 until 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning 2021 DB * ************************************************ *00 Opening 2021 dataset, cleaning use "$rawdata/PRY_2021_LAPOP_AmericasBarometer_v1.2_w.dta", clear ========== ./Seguridad P£blica/02 Code/Informe 2/01 LAPOP, Cleaning Per£.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 LAPOP, Cleaning Perú Author: Lucas García Date: February 28, 2023 Version: Stata 17 Summary: This dofile cleans Perú LAPOP survey from 2010 until 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning 2021 DB * ************************************************ *00 Opening 2021 dataset, cleaning use "$rawdata/PER_2021_LAPOP_AmericasBarometer_v1.2_w.dta", clear ========== ./Seguridad P£blica/02 Code/Informe 2/01 LAPOP, Cleaning Uruguay.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 LAPOP, Cleaning Uruguay Author: Lucas García Date: March 02, 2023 Version: Stata 17 Summary: This dofile cleans Uruguay LAPOP survey from 2010 until 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning 2021 DB * ************************************************ *00 Opening 2021 dataset, cleaning use "$rawdata/URY_2021_LAPOP_AmericasBarometer_v1.2_w.dta", clear ========== ./Seguridad P£blica/02 Code/Informe 2/01 LAPOP, Cleaning Venezuela.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 LAPOP, Cleaning Venezuela Author: Lucas García Date: March 02, 2023 Version: Stata 17 Summary: This dofile cleans Venezuela LAPOP survey from 2010 until 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" /* ************************************************ * 1. Cleaning 2021 DB * ************************************************ *00 Opening 2021 dataset, cleaning use "$rawdata/ECU_2021_LAPOP_AmericasBarometer_v1.2_w.dta", clear ========== ./Seguridad P£blica/02 Code/Informe 2/01 Latinobarometer, Cleaning Data.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Latinobarometer, Cleaning Data Author: Lucas García Date: March 01, 2023 Version: Stata 17 Summary: This dofile cleans latinobarometer data bases *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning 2020 DB * ************************************************ *00 Opening 2020 dataset & cleaning use "$rawdata/Latinobarometro_2020_Eng_Stata_v1_0", clear ========== ./Seguridad P£blica/02 Code/Informe 2/01 Police LAC Comparison, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Police LAC Comparison, multiple DB, Plots Author: Lucas García Date: March 07, 2023 Version: Stata 17 Summary: This dofile plots Police trust trends for LAC and CHL using 2 different data sources. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Latinobarometro * ************************************************ *-01 Defining temporal file to fill and plot ========== ./Seguridad P£blica/02 Code/Informe 2/01 Police trust, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Police trust, multiple DB, Plots Author: Lucas García Date: March 02, 2023 Version: Stata 17 Summary: This dofile plots Police trust trends using 4 different data sources: CEP, CADEM, Latinobarometro and LAPOP. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Setting temporal file & Opening CEP DB * ************************************************ *00 Defining temporal file to fill and plot ========== ./Seguridad P£blica/02 Code/Informe 2/01 WJP Index trends.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 WJP Index trends Author: Lucas García Date: February 28, 2023 Version: Stata 17 Summary: This dofile plots institutional trust trends from 2015 til 2023, for different periodicity and institutions. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning DB * ************************************************ *00 Opening 2016-2022 dataset, cleaning it and merge with ine projections import excel using "$rawdata/FINAL_2022_wjp_rule_of_law_index_HISTORICAL_DATA_FILE (1)", firstr clear sheet("Historical data") ========== ./Seguridad P£blica/02 Code/Informe 2/02 Congress performance, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 02 Congress performance, multiple DB, Plots Author: Lucas García Date: March 07, 2023 Version: Stata 17 Summary: This dofile plots Congress performance trends using 2 different data sources: CADEM, Paz Ciudadana. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Setting temporal file * ************************************************ *00 Defining temporal file to fill and plot ========== ./Seguridad P£blica/02 Code/Informe 2/02 Justice System performance, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 02 Justice System performance, multiple DB, Plots Author: Lucas García Date: March 07, 2023 Version: Stata 17 Summary: This dofile plots Justice System performance trends using 2 different data sources: CADEM, Paz Ciudadana. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Setting temporal file * ************************************************ *00 Defining temporal file to fill and plot ========== ./Seguridad P£blica/02 Code/Informe 2/02 LAPOP, Appending and plotting.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 02 LAPOP, Appending and plotting Author: Lucas García Date: February 28, 2023 Version: Stata 17 Summary: This dofile appends each country LAPOP survey, saves a new DB, erases the individual LAPOP surveys and then plots each variable trend. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Appending each country DB * ************************************************ /* ========== ./Seguridad P£blica/02 Code/Informe 2/02 Latinobarometer, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 02 Latinobarometer, Plots Author: Lucas García Date: March 01, 2023 Version: Stata 17 Summary: This dofile uses latinobarometer data base to plot the relevant trends. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Opening DB * ************************************************ *00 Opening 2020 dataset & cleaning ========== ./Seguridad P£blica/02 Code/Informe 2/02 Police performance, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 02 Police performance, multiple DB, Plots Author: Lucas García Date: March 07, 2023 Version: Stata 17 Summary: This dofile plots Police performance trends using 2 different data sources: CADEM, Paz Ciudadana. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Setting temporal file * ************************************************ *00 Defining temporal file to fill and plot ========== ./Seguridad P£blica/02 Code/Informe 2/02 Public Ministery performance, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 02 Public Ministery performance, multiple DB, Plots Author: Lucas García Date: March 07, 2023 Version: Stata 17 Summary: This dofile plots Public Ministery performance trends using 2 different data sources: CADEM, Paz Ciudadana. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Setting temporal file * ************************************************ *00 Defining temporal file to fill and plot ========== ./Seguridad P£blica/02 Code/Informe 2/Old Do's/01 Checking trends heterogeneity of PAD, ENUSC 16-21.do ========== /******************************************************************************* Project: Seguridad Pública EP, Informe 2 Title: 01 Checking trends heterogeneity of PAD, ENUSC 16-21 Author: Lucas García Date: January 31, 2023 Version: Stata 17 Summary: This dofile uses enusc_16_21 from use data to plot the trends of perceptions of the rise in crime rates, checking heterogeneity by different social variables. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. PAD TRENDS * ************************************************ *00 Open DB & defining data as survey ========== ./Seguridad P£blica/02 Code/Informe 2/Old Do's/02 Checking trends heterogeneity of Information sources, Country level, ENUSC 16-21.do ========== /******************************************************************************* Project: Seguridad Pública EP, Informe 2 Title: 02 Checking trends heterogeneity of Information sources, Country level, ENUSC 16-21 Author: Lucas García Date: February 07, 2023 Version: Stata 17 Summary: This dofile uses enusc_16_21 from use data to plot the trends of information sources related to the perception of rise in crime rates, checking heterogeneity by different social variables. First Section plots 2021 alone and the trend 2016-2021 (excluding 2020 because there is no info of that year in ENUSC). Second section plots checking heterogeneity by gender. Third section plots checking heterogeneity by education level. Fourth section plots checking heterogeneity by laboral situation. Fifth section plots checking heterogeneity by age range. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } ========== ./Seguridad P£blica/02 Code/Informe 2/Old Do's/03 Checking trends heterogeneity of Information sources, Municipality level, ENUSC 16-21.do ========== /******************************************************************************* Project: Seguridad Pública EP, Informe 2 Title: 03 Checking trends heterogeneity of Information sources, Municipality level, ENUSC 16-21 Author: Lucas García Date: February 07, 2023 Version: Stata 17 Summary: This dofile uses enusc_16_21 from use data to plot the trends of information sources related to the perception of rise in crime rates at municipality level. As there is no information of this question on 2020 & 2021, it uses only until 2019. First Section plots the trend 2016-2019. Second section plots checking heterogeneity by gender. Third section plots checking heterogeneity by education level. Fourth section plots checking heterogeneity by laboral situation. Fifth section plots checking heterogeneity by age range. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } ========== ./Seguridad P£blica/02 Code/Informe 2/Old Do's/04 Checking trends heterogeneity of Future Victimization, ENUSC 16-21.do ========== /******************************************************************************* Project: Seguridad Pública EP, Informe 2 Title: 04 Checking trends heterogeneity of Future Victimization, ENUSC 16-21 Author: Lucas García Date: February 14, 2023 Version: Stata 17 Summary: This dofile uses enusc_16_21 from use data to plot the trends of beliefs of future victimization, checking heterogeneity by different social variables. The second section plots the crimes that people believe are going to be a victim, conditional on the belief that they will be a victim of a crime in the next 12 months. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ ========== ./Seguridad P£blica/02 Code/Informe 2/Old Do's/05 Checking trends heterogeneity of Insecurity Sensation, ENUSC 16-21.do ========== /******************************************************************************* Project: Seguridad Pública EP, Informe 2 Title: 05 Checking trends heterogeneity of Insecurity Sensation, ENUSC 16-21 Author: Lucas García Date: February 14, 2023 Version: Stata 17 Summary: This dofile uses enusc_16_21 from use data to plot the trends of perceptions of insecurity sensation in specific situations, checking heterogeneity by different social variables. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. PAD TRENDS * ************************************************ *00 Open DB & defining data as survey ========== ./Seguridad P£blica/02 Code/Update, Homicides trends, CEAD 2022 complete.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: Update, Homicides trends, CEAD 2022 complete Author: Lucas García Date: February 16, 2023 Version: Stata 17 Summary: This dofile plots homicides trends using data from CEAD. It plots the trend of all homicides from 2016 to 2022. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Data 16-22, * ************************************************ *00 Opening 2016-2022 dataset, cleaning it and merge with ine projections import excel using "$rawdata/reportesEstadisticos-unidadTerritorial, CEAD homicidios con 2022 año completo", firstr sh("Hoja1") ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/01 Cleaning Data, ENUSC 16-21.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Cleaning Data, ENUSC 16-21 Author: Lucas García Date: November 11, 2022 Version: Stata 17 Summary: This dofile sets the data to check different tendencies of the different common variables between the ENUSC surveys of 2016 to 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Enusc 16 21" global tables "$path/06 Tables" ************************************************ * 1. Cleaning data * ************************************************ ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 1/00 Master Do file, Informe 1.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 00 Master Do file, Informe 1 Author: Lucas García Date: December 13, 2022 Version: Stata 17 Summary: This dofile prepares the data to plot each one of the Figures of the article "Informe de Seguridad Pública: Tendencias recientes en crimen". To be used, you must check the address of each dofile called and of each folder where the figures are saved. *******************************************************************************/ clear all ************************************************* * 0. Key Macros * ************************************************* *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" version 17.0 ****************************************************** ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 1/01 Clean data, INE projections.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Clean data, INE projections Author: Lucas García Date: November 29, 2022 Version: Stata 17 Summary: This dofile sets the population projections from INE for each region from 2002 to 2035. It keeps jist 2016-2022 *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Cleaning data * ************************************************ *00 Open DB import delimited using "$rawdata/ine_estimaciones-y-proyecciones-2002-2035_base-2017_region_base", clear ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 1/01 Cleaning Data, ENUSC 08-15, incomplete.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Cleaning Data, ENUSC 08-15, incomplete Author: Lucas García Date: December 02, 2022 Version: Stata 17 Summary: This dofile sets the data to check different tendencies of the different common variables between the ENUSC surveys of 2008 to 2015. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Enusc 08 15" global tables "$path/06 Tables" ************************************************ * 1. Cleaning data * ************************************************ ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 1/01 Cleaning Data, ENUSC 08-21.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Trends Long Term, ENUSC 08-21 Author: Lucas García Date: November 11, 2022 Version: Stata 17 Summary: This dofile plots the trends of perception of delinquency, victimization and revictimization from 2008 to 2021 using the interanual ENUSC data base. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Enusc 08 21" global tables "$path/06 Tables" ************************************************ * 1. Preparing data * ************************************************ *00 Opening DB ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 1/01 Cleaning Data, ENUSC 16-21.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Cleaning Data, ENUSC 16-21 Author: Lucas García Date: November 11, 2022 Version: Stata 17 Summary: This dofile sets the data to check different tendencies of the different common variables between the ENUSC surveys of 2016 to 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Enusc 16 21" global tables "$path/06 Tables" ************************************************ * 1. Cleaning data * ************************************************ ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 1/01 Corr delta(perc-vict) - delta(homicides).do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Corr delta(perc-vict) - delta(homicides) Author: Lucas García Date: November 29, 2022 Version: Stata 17 Summary: This dofile plots the correlation between the delta of 2022 with 2016 of the difference between individual perception and individual victimization, against the delta of region level homicides. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Data of ENUSC * ************************************************ ******* 2016-2021 ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 1/01 DEIS.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Homicides trends, Minsal Author: Lucas García Date: November 20, 2022 Version: Stata 17 Summary: This dofile plots gun shot deaths trends using data from Health Ministery. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Data * ************************************************ *00 Open DB import delimited using "$rawdata/DEFUNCIONES_FUENTE_DEIS_2016_2022_10112022", clear ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 1/01 DMCS Cead y ENUSC.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 DMCS Cead y ENUSC Author: Lucas García Date: December 09, 2022 Version: Stata 17 Summary: This dofile sets the data as survey data and plots the trends of biggest social connotation crimes from CEAD and from ENUSC. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Preparing data * ************************************************ *00 Opening DB ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 1/01 Homicides trends, CEAD, Fiscalía y DEIS.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Homicides trends, CEAD, Fiscalía y DEIS Author: Lucas García Date: November 22, 2022 Version: Stata 17 Summary: This dofile plots homicides trends using data from CEAD and from Fiscalia *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Data 16-21 CEAD y Fiscalia * ************************************************ *00 Opening 2016-2021 dataset use "$usedata/cead" ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 1/01 Homicides trends, CEAD y Fiscalía.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Homicides trends, CEAD y Fiscalía Author: Lucas García Date: November 22, 2022 Version: Stata 17 Summary: This dofile plots homicides trends using data from CEAD and from Fiscalia *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Data 16-21 CEAD y Fiscalia * ************************************************ *00 Opening 2016-2021 dataset use "$usedata/cead" ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 1/01 Homicides trends, CEAD.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Homicides trends, CEAD Author: Lucas García Date: November 21, 2022 Version: Stata 17 Summary: This dofile plots homicides trends using data from CEAD. It plots the trend of all homicides from 2016 to 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Data 16-21, * ************************************************ *00 Opening 2016-2021 dataset and merge with ine projections import excel using "$rawdata/reportesEstadisticos-unidadTerritorial, CEAD", firstr sh("Hoja1") ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 1/01 Homicides trends, Fiscalía.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Homicides trends, Fiscalía Author: Lucas García Date: November 20, 2022 Version: Stata 17 Summary: This dofile plots homicides trends using data from Fiscalia. First it plots the trend of all homicides from 2016 to 2021 and then just the cumulative homicides from january to december from 2016 to 2022. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Data 16-21 * ************************************************ ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 1/01 How people inform, ENUSC 16-21.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 How people inform, ENUSC Author: Lucas García Date: November 11, 2022 Version: Stata 17 Summary: This dofile plots a bar graph woth how people inform using enusc 2016, 2017, 2017, 2019 & 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Preparing data, 2021 * ************************************************ *00 Opening DB use "$usedata/enusc_16_21", clear ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 1/01 Theft trends, Fiscalía.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Theft trends, Fiscalía Author: Lucas García Date: November 20, 2022 Version: Stata 17 Summary: This dofile plots theft trends using data from Fiscalia. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Data 16-21 * ************************************************ *Use Ine projections and Collapse to keep relevant info use "$usedata/ine_projections_16_22", clear ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 1/02 Tendencias de las variables, ENUSC 16-21.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 02 Tendencias de las variables Author: Lucas García Date: November 17, 2022 Version: Stata 17 Summary: This dofile sets the data as survey data and plots the trends of different variables: The victimization *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Defining data as survey * ************************************************ *00 Open Database ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 CADEM Trust trends.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 CADEM Trust trends Author: Lucas García Date: February 28, 2023 Version: Stata 17 Summary: This dofile plots institutional trust trends from 2015 til 2023, for different periodicity and institutions. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning DB * ************************************************ *00 Opening 2016-2022 dataset import excel using "$rawdata/Cadem, evolutivo evaluación Instituciones", firstr clear sheet("Serie") ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 CEP Trust trends.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 CEP Trust trends Author: Lucas García Date: February 28, 2023 Version: Stata 17 Summary: This dofile plots institutional trust trends from 2015 til 2023, for different periodicity and institutions. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning DB * ************************************************ *00 Opening CEP historic dataset use "$rawdata/base_consolidada_2000_2022_v2 CEP.dta", clear ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 Congress LAC Comparison, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Congress LAC Comparison, multiple DB, Plots Author: Lucas García Date: March 07, 2023 Version: Stata 17 Summary: This dofile plots Congress trust trends using 2 different data sources: Latinobarometro and LAPOP. It compares LAC and Chile *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 2. Latinobarometro * ************************************************ *00 Defining temporal file to fill and plot ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 Congress trust, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Congress trust, multiple DB, Plots Author: Lucas García Date: March 07, 2023 Version: Stata 17 Summary: This dofile plots Congress trust trends using 3 different data sources: CEP, Latinobarometro and LAPOP. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Setting temporal file & Opening CEP DB * ************************************************ *00 Defining temporal file to fill and plot ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 Elections LAC Comparison, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Elections LAC Comparison, multiple DB, Plots Author: Lucas García Date: March 07, 2023 Version: Stata 17 Summary: This dofile plots Electoral institutions trust trends using 2 different data sources: Latinobarometro and LAPOP. It compares LAC and Chile *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 2. Latinobarometro * ************************************************ *00 Defining temporal file to fill and plot ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 ENUSC Variables.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 ENUSC Variables Author: Lucas García Date: March 03, 2023 Version: Stata 17 Summary: This dofile uses ENUSC Database in order to plot the trends of Police Trust from 2016 until 2019. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Defining data as survey * ************************************************ *00 Open Database ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 Government trust, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Government trust, multiple DB, Plots Author: Lucas García Date: March 21, 2023 Version: Stata 17 Summary: This dofile plots Government trust trends using 3 different data sources: CEP, Latinobarometro and Bicentenario UC. It also plots Government's mark performance trend according to Paz Ciudadana. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Setting temporal file & Opening CEP DB * ************************************************ ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 Justice LAC Comparison, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Justice LAC Comparison, multiple DB, Plots Author: Lucas García Date: March 07, 2023 Version: Stata 17 Summary: This dofile plots Justice trust trends using 2 different data sources: Latinobarometro, LAPOP. It compares LAC with Chile *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Setting temporal file * ************************************************ *00 Defining temporal file to fill and plot ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 Justice trust, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Justice trust, multiple DB, Plots Author: Lucas García Date: March 02, 2023 Version: Stata 17 Summary: This dofile plots Justice trust trends using 4 different data sources: CEP, CADEM, Latinobarometro, LAPOP and WJP. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Setting temporal file & Opening CEP DB * ************************************************ *00 Defining temporal file to fill and plot ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 LAPOP, Cleaning Chile.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 LAPOP, Cleaning Chile Author: Lucas García Date: February 28, 2023 Version: Stata 17 Summary: This dofile cleans Chilean LAPOP survey from 2010 until 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning 2021 DB * ************************************************ *00 Opening 2021 dataset, cleaning use "$rawdata/CHL_2021_LAPOP_AmericasBarometer_v1.2_w.dta", clear ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 LAPOP, Cleaning Argentina.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 LAPOP, Cleaning Argentina Author: Lucas García Date: February 28, 2023 Version: Stata 17 Summary: This dofile cleans Argentina LAPOP survey from 2010 until 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning 2021 DB * ************************************************ *00 Opening 2021 dataset, cleaning use "$rawdata/ARG_2021_LAPOP_AmericasBarometer_v1.2_w.dta", clear ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 LAPOP, Cleaning Bolivia.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 LAPOP, Cleaning Bolivia Author: Lucas García Date: February 28, 2023 Version: Stata 17 Summary: This dofile cleans Perú LAPOP survey from 2010 until 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning 2021 DB * ************************************************ *00 Opening 2021 dataset, cleaning use "$rawdata/BOL_2021_LAPOP_AmericasBarometer_v1.2_w.dta", clear ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 LAPOP, Cleaning Brazil.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 LAPOP, Cleaning Brazil Author: Lucas García Date: March 02, 2023 Version: Stata 17 Summary: This dofile cleans Brazil LAPOP survey from 2010 until 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning 2021 DB * ************************************************ *00 Opening 2021 dataset, cleaning use "$rawdata/BRA_2021_LAPOP_AmericasBarometer_v1.2_w.dta", clear ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 LAPOP, Cleaning Colombia.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 LAPOP, Cleaning Colombia Author: Lucas García Date: February 28, 2023 Version: Stata 17 Summary: This dofile cleans Colombia LAPOP survey from 2010 until 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning 2021 DB * ************************************************ *00 Opening 2021 dataset, cleaning use "$rawdata/COL_2021_LAPOP_AmericasBarometer_v1.2_w.dta", clear ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 LAPOP, Cleaning Ecuador.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 LAPOP, Cleaning Ecuador Author: Lucas García Date: March 02, 2023 Version: Stata 17 Summary: This dofile cleans Ecuador LAPOP survey from 2010 until 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning 2021 DB * ************************************************ *00 Opening 2021 dataset, cleaning use "$rawdata/ECU_2021_LAPOP_AmericasBarometer_v1.2_w.dta", clear ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 LAPOP, Cleaning Mexico.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 LAPOP, Cleaning Mexico Author: Lucas García Date: March 02, 2023 Version: Stata 17 Summary: This dofile cleans Mexico LAPOP survey from 2010 until 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning 2021 DB * ************************************************ *00 Opening 2021 dataset, cleaning use "$rawdata/MEX_2021_LAPOP_AmericasBarometer_v1.2_w.dta", clear ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 LAPOP, Cleaning Paraguay.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 LAPOP, Cleaning Paraguay Author: Lucas García Date: March 02, 2023 Version: Stata 17 Summary: This dofile cleans Paraguay LAPOP survey from 2010 until 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning 2021 DB * ************************************************ *00 Opening 2021 dataset, cleaning use "$rawdata/PRY_2021_LAPOP_AmericasBarometer_v1.2_w.dta", clear ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 LAPOP, Cleaning Perú.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 LAPOP, Cleaning Perú Author: Lucas García Date: February 28, 2023 Version: Stata 17 Summary: This dofile cleans Perú LAPOP survey from 2010 until 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning 2021 DB * ************************************************ *00 Opening 2021 dataset, cleaning use "$rawdata/PER_2021_LAPOP_AmericasBarometer_v1.2_w.dta", clear ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 LAPOP, Cleaning Uruguay.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 LAPOP, Cleaning Uruguay Author: Lucas García Date: March 02, 2023 Version: Stata 17 Summary: This dofile cleans Uruguay LAPOP survey from 2010 until 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning 2021 DB * ************************************************ *00 Opening 2021 dataset, cleaning use "$rawdata/URY_2021_LAPOP_AmericasBarometer_v1.2_w.dta", clear ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 LAPOP, Cleaning Venezuela.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 LAPOP, Cleaning Venezuela Author: Lucas García Date: March 02, 2023 Version: Stata 17 Summary: This dofile cleans Venezuela LAPOP survey from 2010 until 2021. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" /* ************************************************ * 1. Cleaning 2021 DB * ************************************************ *00 Opening 2021 dataset, cleaning use "$rawdata/ECU_2021_LAPOP_AmericasBarometer_v1.2_w.dta", clear ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 Latinobarometer, Cleaning Data.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Latinobarometer, Cleaning Data Author: Lucas García Date: March 01, 2023 Version: Stata 17 Summary: This dofile cleans latinobarometer data bases *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning 2020 DB * ************************************************ *00 Opening 2020 dataset & cleaning use "$rawdata/Latinobarometro_2020_Eng_Stata_v1_0", clear ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 Police LAC Comparison, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Police LAC Comparison, multiple DB, Plots Author: Lucas García Date: March 07, 2023 Version: Stata 17 Summary: This dofile plots Police trust trends for LAC and CHL using 2 different data sources. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Latinobarometro * ************************************************ *-01 Defining temporal file to fill and plot ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 Police trust, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 Police trust, multiple DB, Plots Author: Lucas García Date: March 02, 2023 Version: Stata 17 Summary: This dofile plots Police trust trends using 4 different data sources: CEP, CADEM, Latinobarometro and LAPOP. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Setting temporal file & Opening CEP DB * ************************************************ *00 Defining temporal file to fill and plot ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/01 WJP Index trends.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 01 WJP Index trends Author: Lucas García Date: February 28, 2023 Version: Stata 17 Summary: This dofile plots institutional trust trends from 2015 til 2023, for different periodicity and institutions. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Cleaning DB * ************************************************ *00 Opening 2016-2022 dataset, cleaning it and merge with ine projections import excel using "$rawdata/FINAL_2022_wjp_rule_of_law_index_HISTORICAL_DATA_FILE (1)", firstr clear sheet("Historical data") ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/02 Congress performance, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 02 Congress performance, multiple DB, Plots Author: Lucas García Date: March 07, 2023 Version: Stata 17 Summary: This dofile plots Congress performance trends using 2 different data sources: CADEM, Paz Ciudadana. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Setting temporal file * ************************************************ *00 Defining temporal file to fill and plot ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/02 Justice System performance, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 02 Justice System performance, multiple DB, Plots Author: Lucas García Date: March 07, 2023 Version: Stata 17 Summary: This dofile plots Justice System performance trends using 2 different data sources: CADEM, Paz Ciudadana. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Setting temporal file * ************************************************ *00 Defining temporal file to fill and plot ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/02 LAPOP, Appending and plotting.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 02 LAPOP, Appending and plotting Author: Lucas García Date: February 28, 2023 Version: Stata 17 Summary: This dofile appends each country LAPOP survey, saves a new DB, erases the individual LAPOP surveys and then plots each variable trend. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData/LAPOP" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Appending each country DB * ************************************************ /* ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/02 Latinobarometer, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 02 Latinobarometer, Plots Author: Lucas García Date: March 01, 2023 Version: Stata 17 Summary: This dofile uses latinobarometer data base to plot the relevant trends. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Opening DB * ************************************************ *00 Opening 2020 dataset & cleaning ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/02 Police performance, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 02 Police performance, multiple DB, Plots Author: Lucas García Date: March 07, 2023 Version: Stata 17 Summary: This dofile plots Police performance trends using 2 different data sources: CADEM, Paz Ciudadana. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Setting temporal file * ************************************************ *00 Defining temporal file to fill and plot ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/02 Public Ministery performance, multiple DB, Plots.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: 02 Public Ministery performance, multiple DB, Plots Author: Lucas García Date: March 07, 2023 Version: Stata 17 Summary: This dofile plots Public Ministery performance trends using 2 different data sources: CADEM, Paz Ciudadana. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. Setting temporal file * ************************************************ *00 Defining temporal file to fill and plot ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/Old Do's/01 Checking trends heterogeneity of PAD, ENUSC 16-21.do ========== /******************************************************************************* Project: Seguridad Pública EP, Informe 2 Title: 01 Checking trends heterogeneity of PAD, ENUSC 16-21 Author: Lucas García Date: January 31, 2023 Version: Stata 17 Summary: This dofile uses enusc_16_21 from use data to plot the trends of perceptions of the rise in crime rates, checking heterogeneity by different social variables. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. PAD TRENDS * ************************************************ *00 Open DB & defining data as survey ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/Old Do's/02 Checking trends heterogeneity of Information sources, Country level, ENUSC 16-21.do ========== /******************************************************************************* Project: Seguridad Pública EP, Informe 2 Title: 02 Checking trends heterogeneity of Information sources, Country level, ENUSC 16-21 Author: Lucas García Date: February 07, 2023 Version: Stata 17 Summary: This dofile uses enusc_16_21 from use data to plot the trends of information sources related to the perception of rise in crime rates, checking heterogeneity by different social variables. First Section plots 2021 alone and the trend 2016-2021 (excluding 2020 because there is no info of that year in ENUSC). Second section plots checking heterogeneity by gender. Third section plots checking heterogeneity by education level. Fourth section plots checking heterogeneity by laboral situation. Fifth section plots checking heterogeneity by age range. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/Old Do's/03 Checking trends heterogeneity of Information sources, Municipality level, ENUSC 16-21.do ========== /******************************************************************************* Project: Seguridad Pública EP, Informe 2 Title: 03 Checking trends heterogeneity of Information sources, Municipality level, ENUSC 16-21 Author: Lucas García Date: February 07, 2023 Version: Stata 17 Summary: This dofile uses enusc_16_21 from use data to plot the trends of information sources related to the perception of rise in crime rates at municipality level. As there is no information of this question on 2020 & 2021, it uses only until 2019. First Section plots the trend 2016-2019. Second section plots checking heterogeneity by gender. Third section plots checking heterogeneity by education level. Fourth section plots checking heterogeneity by laboral situation. Fifth section plots checking heterogeneity by age range. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/Old Do's/04 Checking trends heterogeneity of Future Victimization, ENUSC 16-21.do ========== /******************************************************************************* Project: Seguridad Pública EP, Informe 2 Title: 04 Checking trends heterogeneity of Future Victimization, ENUSC 16-21 Author: Lucas García Date: February 14, 2023 Version: Stata 17 Summary: This dofile uses enusc_16_21 from use data to plot the trends of beliefs of future victimization, checking heterogeneity by different social variables. The second section plots the crimes that people believe are going to be a victim, conditional on the belief that they will be a victim of a crime in the next 12 months. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Informe 2/Old Do's/05 Checking trends heterogeneity of Insecurity Sensation, ENUSC 16-21.do ========== /******************************************************************************* Project: Seguridad Pública EP, Informe 2 Title: 05 Checking trends heterogeneity of Insecurity Sensation, ENUSC 16-21 Author: Lucas García Date: February 14, 2023 Version: Stata 17 Summary: This dofile uses enusc_16_21 from use data to plot the trends of perceptions of insecurity sensation in specific situations, checking heterogeneity by different social variables. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs/Informe 2" global tables "$path/06 Tables" ************************************************ * 1. PAD TRENDS * ************************************************ *00 Open DB & defining data as survey ========== ./Seguridad Pública, Stata/Seguridad Pública/02 Code/Update, Homicides trends, CEAD 2022 complete.do ========== /******************************************************************************* Project: Seguridad Pública EP Title: Update, Homicides trends, CEAD 2022 complete Author: Lucas García Date: February 16, 2023 Version: Stata 17 Summary: This dofile plots homicides trends using data from CEAD. It plots the trend of all homicides from 2016 to 2022. *******************************************************************************/ clear all ************************************************ * 0. Key Macros * ************************************************ *Folder globals di "current user: `c(username)'" if "`c(username)'" == "Lucas"{ global path "C:\Users\Lucas\Dropbox\Seguridad Pública" } else if "`c(username)'" == "add user name"{ global path "" // Escribir Dirección } global rawdata "$path/01 RawData" global dofiles "$path/02 Code" global usedata "$path/04 Usedata" global graphs "$path/05 Graphs" global tables "$path/06 Tables" ************************************************ * 1. Data 16-22, * ************************************************ *00 Opening 2016-2022 dataset, cleaning it and merge with ine projections import excel using "$rawdata/reportesEstadisticos-unidadTerritorial, CEAD homicidios con 2022 año completo", firstr sh("Hoja1")