clear all ********************************** ***Set up Database 1990 to 2002*** ********************************** forvalues i=1990/2002 { // load data local j=mod(`i', 100) if `i'>1999{ local j="0`j'" } di "`j'" use "$Path_enquete90\EnquĂȘte Emploi - `i'\Stata\empl`j'qi.dta", clear // Uniform names foreach var of varlist _all{ rename `var' `=upper("`var'")' } gen int ANNEE=`i' // fix var names so I have the same names across years capture rename S SEXE capture rename N NATIONALITY capture rename NOIPP0 NOIPP // keep vars keep IDENTM NOI ANNEE NAIA NAIM EXTRI AG SEXE FORM NATIONALITY NOIPP LPRM DEPNAI PNAI RG CSPP REA ACT7 FI STJ DIPL DDIPL tostring IDENTM NOI ANNEE NAIA NAIM EXTRI AG SEXE FORM NATIONALITY NOIPP LPRM DEPNAI PNAI RG CSPP REA ACT7 FI STJ DIPL DDIPL, replace destring EXTRI, replace tempfile temp_`i' /* create a temporary file */ save "`temp_`i''" /* save memory into the temporary file */ } ////////////////////////// Append data drop _all set obs 1 generate a = 999999 forvalues i=1990/2002 { // append append using "`temp_`i''", generate(source_`i') } // drop auxiliar keep if a==. drop a // check that I am not missing anything drop source_* destring _all, replace rename IDENTM IDENT ************************** ***Generating Variables*** ************************** // Gender, checked and good gen female=(SEXE==2) if SEXE!=. // born in france, checked and good gen born_france=(PNAI==.) //This is only conducted in mainland france, checked and good gen int mainland_france=1 // DNAI, checked and good egen DNAI=group(DEPNAI), missing // French born in France gen french_bybirth=(NATIONALITY==1) if NATIONALITY!=. // muslim *1 gen musnat1=(NATIONALITY==11|NATIONALITY==12|NATIONALITY==13|NATIONALITY==14|NATIONALITY==45) if NATIONALITY!=. *2 gen musnat2=(NATIONALITY==2 & (PNAI==11|PNAI==12|PNAI==13|PNAI==14|PNAI==45)) if NATIONALITY!=. & PNAI!=. egen musall=rowmax(musnat1 musnat2) // for clustered se gen nat=. replace nat=1 if NATIONALITY==1 replace nat=2 if ((NATIONALITY==11|NATIONALITY==12|NATIONALITY==13) | (NATIONALITY==2 & (PNAI==11|PNAI==12|PNAI==13))) replace nat=3 if (NATIONALITY==14 | (NATIONALITY==2 & (PNAI==14))) replace nat=4 if (NATIONALITY==45 | (NATIONALITY==2 & PNAI==45)) //////////////////////////////////// Muslim egen famid=group(IDENT) gen TRIM=1 gen parents_maghreb_me=. label var parents_maghreb_me "Muslim background" su NOI forvalues i=`r(min)'/`r(max)' { gen pere_nat_aux_`i'=musall if NOI==`i' bys IDENT ANNEE TRIM: egen pere_nat_`i'=max(pere_nat_aux_`i') replace parents_maghreb_me=pere_nat_`i' if NOIPP==`i' drop pere_nat_aux_`i' pere_nat_`i' } gen parents_french=. label var parents_french "non-Muslim background" su NOI forvalues i=`r(min)'/`r(max)' { gen pere_nat_aux_`i'=french_bybirth if NOI==`i' bys IDENT ANNEE TRIM: egen pere_nat_`i'=max(pere_nat_aux_`i') replace parents_french=pere_nat_`i' if NOIPP==`i' drop pere_nat_aux_`i' pere_nat_`i' } gen natfather=. su NOI forvalues i=`r(min)'/`r(max)' { gen pere_nat_aux_`i'=nat if NOI==`i' bys IDENT ANNEE TRIM: egen pere_nat_`i'=max(pere_nat_aux_`i') replace natfather=pere_nat_`i' if NOIPP==`i' drop pere_nat_aux_`i' pere_nat_`i' } drop if ANNE>=2000 //////////////// outcome gen rea2_aux=1 if REA==2 bys IDENT NOI: egen rea2=max(rea2_aux) replace rea2=0 if rea2==. gen rea3_aux=1 if REA==3 bys IDENT NOI: egen rea3=max(rea3_aux) replace rea3=0 if rea3==. replace rea2=abs(1-rea2) replace rea3=abs(1-rea3) * father tostring CSPP, replace force gen skilled_father=. replace skilled_father=1 if CSPP=="21" |CSPP=="22" |CSPP=="23" |CSPP=="31" |CSPP=="33" |CSPP=="34" |CSPP=="35" |CSPP=="37"|CSPP=="38" |CSPP=="42" |CSPP=="43" |CSPP=="44" |CSPP=="45" |CSPP=="46" |CSPP=="47" |CSPP=="48" |CSPP=="72" |CSPP=="74" |CSPP=="75" replace skilled_father=0 if skilled_father!=1 & CSPP=="10" |CSPP=="11" |CSPP=="12" |CSPP=="13" |CSPP=="52" |CSPP=="53" |CSPP=="54" |CSPP=="55" |CSPP=="56" |CSPP=="62" |CSPP=="63" |CSPP=="64" |CSPP=="65" |CSPP=="67"|CSPP=="68" |CSPP=="69" |CSPP=="71" |CSPP=="77" |CSPP=="78" |CSPP=="81" |CSPP=="82" |CSPP=="84"|CSPP=="85" |CSPP=="86" replace skilled_father=. if CSPP=="0" label var skilled_father "Father is a skilled worker" gen dum_skilfather=(skilled_father==.) replace skilled_father=0 if skilled_father==. // other vars egen nat_cohort_dep=group(DNAI natfather), missing egen survey=group(ANNE), missing rename natfather NATPER ****************** *****Table B5***** ****************** preserve keep if REA==1 gen post=(ANNE>1993) if ANNE!=. global ctrl "i.NAIA i.survey i.DNAI i.NATPER skilled_father dum_skilfather" global ag=18 **Model (1) su rea2 if parents_maghreb_me==1 & ANNE<=1993 local musmean=round(r(mean),0.001) su rea2 if parents_french==1 & ANNE<=1993 local notmusmean=round(r(mean),0.001) reg rea2 parents_maghreb_me##c.post $ctrl if mainland_france==1 & (parents_maghreb_me ==1 | parents_french ==1 ) & AG<$ag & born_france==1 & female==1, vce(cluster nat_cohort_dep) outreg2 using "$Tables/Table B5 models (1) and (2).xls", replace keep(1.parents_maghreb_me#c.post) label addtext(Dep var Muslim, `musmean', Dep var non-Muslim, `notmusmean') **Model (2) su rea3 if parents_maghreb_me==1 & ANNE<=1993 local musmean=round(r(mean),0.001) su rea3 if parents_french==1 & ANNE<=1993 local notmusmean=round(r(mean),0.001) reg rea3 c.post##parents_maghreb_me $ctrl if mainland_france==1 & (parents_maghreb_me ==1 | parents_french ==1 ) & AG<$ag & born_france==1 & female==1, vce(cluster nat_cohort_dep) outreg2 using "$Tables/Table B5 models (1) and (2).xls", append keep(1.parents_maghreb_me#c.post) label addtext(Dep var Muslim, `musmean', Dep var non-Muslim, `notmusmean') restore **Model(3) preserve keep if REA==1 & ANNE <2000 & mainland_france==1 & (parents_maghreb_me ==1 | parents_french ==1 ) & AG<18 & born_france==1 collapse (mean) female survey NATPER skilled_father dum_skilfather parents_maghreb_me ANNE NAIA parents_french, by(IDENT) replace parents_maghreb_me=. if !inlist(parents_maghreb_me,0,1) replace parents_french=. if !inlist(parents_french,0,1) drop if parents_french==.| parents_maghreb_me==. gen post=(ANNE>1993) su female if parents_maghreb_me==1 & ANNE<=1993 local musmean=round(r(mean),0.001) su female if parents_french==1 & ANNE<=1993 local notmusmean=round(r(mean),0.001) reg female c.post##parents_maghreb_me i.survey i.NATPER skilled_father dum_skilfather, r outreg2 using "$Tables/Table B5 model (3).xls", replace keep(1.parents_maghreb_me#c.post) label addtext(Dep var Muslim 1990-93, `musmean', Dep var non-Muslim 1990-93, `notmusmean') restore