Skip to content

Instantly share code, notes, and snippets.

@benzipperer
Last active October 25, 2023 16:50
Show Gist options
  • Save benzipperer/7860f1055036b95d9e04a212e2b61bed to your computer and use it in GitHub Desktop.
Save benzipperer/7860f1055036b95d9e04a212e2b61bed to your computer and use it in GitHub Desktop.
modified replication package for DGLR 2020, to calculate mean employment of regression sample in Table A1, Women High School or Less
/* BEGIN BZ MODIFICATIONS */
/* this do-file requires the following files from the authors
medicaidelig.dta
UKCPR_National_Welfare_Data_Update_021520.dta
*/
copy https://github.com/Economic/state_geocodes/raw/master/state_geocodes.dta state_geocodes.dta, replace
use state_geocodes, clear
rename state_census stcps
rename state_fips statefips
keep stcps statefips
tempfile state_geocodes
save `state_geocodes'
copy https://github.com/benzipperer/historicalminwage/releases/download/v1.4.0/mw_state_stata.zip mw_state_stata.zip, replace
unzipfile mw_state_stata.zip, replace
/* END BZ MODIFICATIONS */
clear
* this file makes the wage panel
cap mkdir "cperraw"
cd cperraw
forvalues year=1999/2017 { // not sure if the 2019 data is online yeat
/* BEGIN BZ MODIFICATIONS: update URL */
copy https://ceprdata.s3.amazonaws.com/data/cps/data/cepr_org_`year'.zip cper_org_`year'.zip, replace
/* END BZ MODIFICATIONS */
unzipfile cper_org_`year', replace
}
cd ..
forvalues year=1999/2017{
use female age educ wage* emp* year married state wbho age *wgt* rw* using "cperraw/cepr_org_`year'"
if `year'>1999 append using wagepanel
save wagepanel, replace
}
* STATE VARIABLE
use wagepanel if year>=1999 & year<=2017, clear
keep if age>=18 & age<=64
rename state stcps
gen state= .
replace state=20 if stcps==11 /*Maine */
replace state=30 if stcps==12 /*NewHampshire */
replace state=46 if stcps==13 /*Vermont */
replace state=22 if stcps==14 /*Massachusetts*/
replace state=40 if stcps==15 /*RhodeIsland */
replace state=7 if stcps==16 /*Connecticut */
replace state=33 if stcps==21 /*NewYork */
replace state=31 if stcps==22 /*NewJersey */
replace state=39 if stcps==23 /*Pennsylvania */
replace state=36 if stcps==31 /*Ohio */
replace state=15 if stcps==32 /*Indiana */
replace state=14 if stcps==33 /*Illinois */
replace state=23 if stcps==34 /*Michigan */
replace state=50 if stcps==35 /*Wisconsin */
replace state=24 if stcps==41 /*Minnesota */
replace state=16 if stcps==42 /*Iowa */
replace state=26 if stcps==43 /*Missouri */
replace state=35 if stcps==44 /*NorthDakota */
replace state=42 if stcps==45 /*SouthDakota */
replace state=28 if stcps==46 /*Nebraska */
replace state=17 if stcps==47 /*Kansas */
replace state=8 if stcps==51 /*Delaware */
replace state=21 if stcps==52 /*Maryland */
replace state=9 if stcps==53 /*DC */
replace state=47 if stcps==54 /*Virginia */
replace state=49 if stcps==55 /*WestVirginia */
replace state=34 if stcps==56 /*NorthCarolina*/
replace state=41 if stcps==57 /*SouthCarolina*/
replace state=11 if stcps==58 /*Georgia */
replace state=10 if stcps==59 /*Florida */
replace state=18 if stcps==61 /*Kentucky */
replace state=43 if stcps==62 /*Tennessee */
replace state=1 if stcps==63 /*Alabama */
replace state=25 if stcps==64 /*Mississippi */
replace state=4 if stcps==71 /*Arkansas */
replace state=19 if stcps==72 /*Louisiana */
replace state=37 if stcps==73 /*Oklahoma */
replace state=44 if stcps==74 /*Texas */
replace state=27 if stcps==81 /*Montana */
replace state=13 if stcps==82 /*Idaho */
replace state=51 if stcps==83 /*Wyoming */
replace state=6 if stcps==84 /*Colorado */
replace state=32 if stcps==85 /*NewMexico */
replace state=3 if stcps==86 /*Arizona */
replace state=45 if stcps==87 /*Utah */
replace state=29 if stcps==88 /*Nevada */
replace state=48 if stcps==91 /*Washington */
replace state=38 if stcps==92 /*Oregon */
replace state=5 if stcps==93 /*California */
replace state=2 if stcps==94 /*Alaska */
replace state=12 if stcps==95 /*Hawaii */
label var state "[TS2] State (SOI codes)"
/* BEGIN BZ MODIFICATIONS */
/*
ren state stateoc
merge m:1 stateoc using stateoc2statefips
ren Fips statefips
*/
merge m:1 stcps using `state_geocodes', assert(3) nogenerate
/* END BZ MODIFICATIONS */
** merge with the minimum wage data
merge m:1 statefips year using mw_state_annual, keep(3) nogen //1 obs per statefips year
g logmw = log(mean_mw)
sum year
** group states
gen edcat = 1 if educ == 1 | educ == 2
replace edcat = 2 if educ == 3
replace edcat = 3 if educ >=4
g agecat = .
local t 1
foreach h in 25 35 45 55 65 {
replace agecat = `t' if agecat ==. & age<`h'
local t = `t' + 1
}
tab age agecat
g logrealwage = log(rw)
g logwage = log(wage4)
g state_fips = statefips
merge m:1 state_fips year using UKCPR_National_Welfare_Data_Update_021520, keepusing(Population Unemploymentrate GrossStateProduct SSIrecipients AFDCTANF_FS3PersonBenefit FSSNAPBenefitfor3personfam) keep(3) nogen // add population, unemployment rate etc
replace year = year - 1
merge m:1 state_fips year using UKCPR_National_Welfare_Data_Update_021520, keepusing(EITCMaximumCredit2Dependents StateEITCRate GovernorisDemocrat1Yes FractionofStateHousethatis FractionofStateSenatethatis) keep(3) nogen // add population, unemployment rate etc
replace year = year + 1
merge m:1 statefips year using "medicaidelig", keep(1 3) nogen
foreach x in medicaidelig mcaidexpand mcaidexpand2 {
replace `x' = 0 if `x' == . // no data 1999-2010
}
g logsnap = log(FSSNAP)
label var logsnap "Log SNAP benefits (3 persons)"
g eitcfam3 = log(EITCMax*(1+StateEITCRate))
label var eitcfam "Log EITC (2 dependents)"
g logstategdp=log(GrossStateProduct)
g logssi = log(SSIrecipients/Pop)
g logpop=log(Pop)
ren female sex
save agregsample, replace
/* BEGIN BZ MODIFICATIONS */
* confirm employment effect in Table A1, panel B, specification 2
use agregsample if edcat == 1, clear
reghdfe empl logmw logssi logstategdp logpop Unemp eitcfam3 [aw=orgwgt] if sex == 1, a(statefips year wbho age sex educ) cluster(statefips)
* calculate mean employment of sample
sum empl [aw=orgwgt] if e(sample) == 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment