Readme file for: "The Wage Penalty to Undocumented Immigration", by George Borjas and Hugh Cassidy. Forthcoming, Labour Economics.

Instructions to replicate results:

-Download American Community Survey (ACS) data, 2008-2016 downloaded from the Integrated Public Use Microdata Series (IPUMS): https://usa.ipums.org/usa/. Save Stata data file name "acs.dta" to folder: "acs".

-Download O*NET task data, version 17.0, available here: https://www.onetcenter.org/db_releases.html. Save to folder "ONET".

-Generate occupational task requirements: Execute Stata files:
	1) assignTasksONET.do
	2) generateCrosswalkAndTasks.do
	-creates dataset "occ1990tasks.dta" which contains the task requirements by "occ1990" occupation code

-Run Stata file: main.do. This file will execute all of the Stata code needed to produce the results, including allocating undocumented status, after occupational tasks are generatad. Log files are saved in the folder: "Logs"

Note: Replicating code requires installing Stata package "b1x2" by Jonah Gelbach.

List of files:

assignTasksONet.do: Read in O*NET task requirements, aggregates occupational characteristics by 6-digit SOC code for merging with the 2010-2016 ACS to create Census 1990/2010 SOC occupation code crosswalk.

generateCrosswalkAndTasks.do: Merges 2010-2016 ACS with O*NET occupational characteristics. Performs principal component analysis to generate cognitive task requirement for each occ1990 occupation. Saves task requirement of each occ1990 occupation code in dataset "occ1990tasks.dta"

generateCrosswalkAndTasks_code.ado: Contains Stata syntax called by generateCrosswalkAndTasks.do.

main.do: main Stata do file, executes other Stata files to generate results (after task requirement dataset has been generated)

create_acs.do: Assign documented/undocumented flag in the ACS. Note that this file re-writes the ACS dataset.

generate_vars_and_sample.ado: Contains syntax that generates our sample from the ACS and generates variables. This file is called by most of the Table_X.do and Fig_X.do Stata files.

generate_vars_and_sample_warren_comparison.ado: Same as "generate_vars_and_sample.ado", but keeps all ages, individuals not working, and those enrolled in school. Called by Table_2.do

generate_vars_and_sample_inschool.ado: Same as "generate_vars_and_sample.ado", but keeps those enrolled in school. Called by Table_4.do

Table_X: Generates results for Table X. 

Tables_5_6.do: Generates results for Tables 5 and 6. Note that this file does NOT call generate_vars_and_sample.ado or any other helper file to generate the sample.

Fig_X.do: Generates results for Figure X.


