*============================================================================= * WORKING ON ELFE DATA *============================================================================= use "D:\partage cloud ined\1. Project\2. Data\1. Elfe\3. Data set\4. DATASET_230916.dta", clear //latest /////////////////////1. VARIABLES YOU WILL NEED ////////////////////////////// *Look at excel file ////////////////////2. CREATION OF NEW VARIABLES////////////////////////////// ***************************0. IDENTIFICATION VARS ***************************** *5.2. Maternity g maternity = 1 if m00m2_faf==1 replace maternity = 0 if inlist(m00m2_faf,.,0) label var maternity "The child is included in the maternity wave" label define maternity 1 "yes" 0 "no" label values maternity maternity tab maternity, missing *5.3. 2 months g months2 = 1 if inlist(m02x_qmerecomp2m,1,2) & inlist(m02x_typqmere2m,1,2,3) //completed and partially completed, mother referent replace months2 = 1 if inlist(m02x_qpecfcomp2m,1,2) & inlist(m02x_typqpecf2m,1,2) //completed and partially completed, father referent replace months2 = 1 if m02x_partimere2m==10 & missing(months2) replace months2 = 0 if missing(months2) label var months2 "The child is included in the 2months wave" label define months2 1 "Yes" 0 "No" label values months2 months2 tab months2, missing *5.4. 1 year g year1 = 1 if inlist(a01x_qmerecomp1a,1,2) & inlist(a01x_typqmere1a,1,2,3) //completed and partially completed, mother referent replace year1 = 1 if inlist(a01x_qpecfcomp1a,1,2) & inlist(a01x_typqpecf1a,1,2) //completed and partially completed, father referent replace year1 = 1 if a01x_partimere1a==10 & missing(year1) replace year1 = 0 if missing(year1) label var year1 "The child is included in the 1 year wave" label define year1 1 "Yes" 0 "No" label values year1 year1 tab year1, missing *** Demenagement between 2months - 1year tab a01m_demenag tab a01p_demenag g demenag = 1 if a01m_demenag==1 replace demenag = 0 if a01m_demenag==2 foreach i of numlist 3/10{ replace demenag = 1 if a01p_demenag==1 & a01p_lientyp_`i'==2 & demenag==. replace demenag = 0 if a01p_demenag==2 & a01p_lientyp_`i'==2 & demenag==. } label var demenag "The household moved between 2months and 1year" label define demenag 1 "Yes" 0 "No" label values demenag demenag tab demenag, missing *****************1. PREGNANCY AND BIRTH CHARACTERISTICS*********************** *1.1 Caesarean variable g cesarean=. replace cesarean=1 if m00x_typacc==3 replace cesarean=0 if inlist(m00x_typacc, 1, 2) label var cesarean "birth cesarean" label define cesarean 0 "no" 1 "yes" label value cesarean cesarean tab cesarean, missing *1.2 Father present at birth g father_present_birth=. replace father_present_birth=1 if m00m2_pereacc==1 replace father_present_birth=0 if m00m2_pereacc==0 label var father_present_birth "father present at birth" label define father_present_birth 0 "no" 1 "yes" label values father_present_birth father_present_birth tab father_present_birth, missing *1.3 Child's sex tab m00x_sexec2 g child_sex = m00x_sexec2 replace child_sex = 0 if child_sex==2 replace child_sex = . if m00x_sexec2==9 label var child_sex "Sex of Elfe child" label define child_sex 1 "Male" 0 "Female" label value child_sex child_sex tab child_sex, missing ************************2. FAMILY SITUATION************************************ *2.1 Rank of child Elfe g rank_elfe=. replace rank_elfe = 1 if m00m2_gant==0 //never pregnant before -> first baby replace rank_elfe = 1 if m00m2_enfgant==0 //pregnant but abortion or misscarriage -> first baby replace rank_elfe = (1 + m00m2_nbgant) if rank_elfe==. //elfe baby + number of previous children label var rank_elfe "rank of child elfe" tab rank_elfe, missing *2.2 Family structure (at birth) g familyb=. replace familyb=1 if m00m2_etatmat==1 & m00m2_couple==1 replace familyb=2 if m00m2_etatmat==2 & m00m2_couple==1 replace familyb=3 if m00m2_etatmat==3 & m00m2_couple==1 replace familyb=3 if m00m2_etatmat==4 & m00m2_couple==1 replace familyb=3 if m00m2_etatmat==5 & m00m2_couple==1 replace familyb=4 if m00m2_couple==0 label var familyb "family structure, birth" label define familyb 1 "married couple" 2 "pacse couple" 3 "free couple" 4 "lone mother" label values familyb familyb tab familyb, missing *2.3 Family structure (at 2 months) g inhhld = . foreach i of numlist 4/6{ replace inhhld = 1 if m02m_lientyp_`i'==1 | m02m_lientyp_`i'==7 //there is a father or a cohabitant in the household } replace inhhld = 0 if inhhld==. & !missing(m02m_lientyp_3) //there is no cohabitant??? g family2m = 4 if inhhld==0 //lone mother if there is no cohabitant replace family2m = 3 if inhhld==1 & inlist(m02m_etamatri, 3,4,5) & missing(family2m) //free couple. there is a cohabitant, they live in couple but they are not pacses or married replace family2m = 2 if inhhld==1 & inlist(m02m_etamatri, 2) & missing(family2m) // pacse couple. there is a cohabitant and they are pacses replace family2m = 1 if inhhld==1 & inlist(m02m_etamatri, 1) & missing(family2m) // married couple. there is a cohabitant and they are married tab family2m m02m_etamatri, missing //all missings are women in couple with a cohabitant, who answered etamatri==6, married ou pacse (??) g inhhldp = . foreach i of numlist 3/10{ replace inhhldp = 1 if m02p_lientyp_`i'==2 //the mother is in the hhld } replace family2m = 3 if m02p_lientyp_4==1 & inhhldp==1 & inlist(m02p_etamatri_4, 3,4,5) & missing(family2m) //free couple. there is the mother, they live in couple but they are not pacses or married replace family2m = 2 if m02p_lientyp_4==1 & inhhldp==1 & inlist(m02p_etamatri_4, 2) & missing(family2m) // pacse couple. there is the mother and they are pacses replace family2m = 1 if m02p_lientyp_4==1 & inhhldp==1 & inlist(m02p_etamatri_4, 1) & missing(family2m) // married couple. there is the mother and they are married label var family2m "family structure, 2 months" label define family2m 1 "married couple" 2 "pacse couple" 3 "free couple" 4 "lone mother" label values family2m family2m tab family2m, missing *2.4. Family structure (at 1 year) *You need family2m g inhhld1 = . foreach i of numlist 4/10{ replace inhhld1 = 1 if a01m_lientyp_`i'==1 | a01m_lientyp_`i'==7 //There is a father or a cohabitant in the household } replace inhhld1 = 0 if inhhld1==. & !missing(a01m_lientyp_ 3) //there is no cohabitant g family1y = 4 if inhhld1==0 //lone mother if there is no cohabitant replace family1y = 1 if inhhld1==1 & a01m_couple2==2 & a01m_etamatri==1 & missing(family1y) // not in couple but marital status married replace family1y = 2 if inhhld1==1 & a01m_couple2==2 & a01m_etamatri==2 & missing(family1y) // not in couple but marital status pacse replace family1y = 3 if inhhld1==1 & a01m_couple2==2 & inlist(a01m_etamatri,3,4,5) & missing(family1y) // not in couple but marital status free couple replace family1y = family2m if inhhld1==1 & a01m_couple1==1 & a01m_matricoupm==1 & missing(family1y) //in couple and same situation as 2 months replace family1y = 3 if inhhld1==1 & a01m_couple2==1 & a01m_matricouphm==2 & missing(family1y) //in couple but not married or pacses, free couple replace family1y = 1 if inhhld1==1 & a01m_couple1==1 & a01m_matricoupm==2 & a01m_etamatri==1 & missing(family1y) //in couple and married replace family1y = 2 if inhhld1==1 & a01m_couple1==1 & a01m_matricoupm==2 & a01m_etamatri==2 & missing(family1y) //in couple and pacses replace family1y = 3 if inhhld1==1 & a01m_couple1==1 & a01m_matricoupm==2 & inlist(a01m_etamatri,3,4,5) & missing(family1y) //free couple replace family1y = 1 if inhhld1==1 & a01m_couple2==1 & a01m_matricouphm==1 & a01m_etamatri==1 & missing(family1y) //in couple and married replace family1y = 2 if inhhld1==1 & a01m_couple2==1 & a01m_matricouphm==1 & a01m_etamatri==2 & missing(family1y) //in couple and pacse label var family1y "Family structure, 1 year" label define family1y 1 "Married couple" 2 "Pacse couple" 3 "Free couple" 4 "lone mother" label values family1y family1y tab family1y, missing *2.5. Not in couple but living together, 2 months *You need inhhld replace inhhld = 0 if inhhld==. & !missing(m02m_lientyp_3) //there is no cohabitant g nclt = 1 if inhhld==1 & m02m_couple1==2 //no couple, living together. there is a cohabitant but they are not in couple replace nclt = 0 if nclt==. & !missing(inhhld) label var nclt "Not in couple but living together, 2 months" label define nclt 1 "yes" 0 "No" label values nclt nclt tab nclt, missing *2.6. Not in couple but living together, 1 year *You need inhhld1 replace inhhld1 = 0 if inhhld1==. & !missing(a01m_lientyp_ 3) //there is no cohabitant g nclt_1y = 1 if inhhld1==1 & a01m_couple1==2 //not in couple but living together replace nclt_1y = 1 if inhhld1==1 & a01m_couple2==2 //not in couple but living together replace nclt_1y = 0 if nclt_1y==. & !missing(inhhld1) label var nclt_1y "Not in couple but living together, 1 year" label define nclt_1y 1 "yes" 0 "No" label values nclt_1y nclt_1y tab nclt_1y, missing *2.7 Father recognized the child g father_recogn_child=. replace father_recogn_child = 1 if m00m2_etatmat==1 & m00m2_couple==1 replace father_recogn_child = 1 if m00m2_reconu==1 & father_recogn_child==. replace father_recogn_child = 1 if m02m_recon==1 & father_recogn_child==. replace father_recogn_child = 1 if a01m_recon==1 & father_recogn_child==. replace father_recogn_child = 0 if m00m2_reconu==0 & father_recogn_child==. replace father_recogn_child = 0 if m02m_recon==2 & father_recogn_child==. replace father_recogn_child = 0 if a01m_recon==2 & father_recogn_child==. label var father_recogn_child "father has recognized the child" label define father_recogn_child 0 "no" 1 "yes" label values father_recogn_child father_recogn_child tab father_recogn_child, missing *2.8 Person living with the child, 2 months g child_hhld = 1 if m02m_efvit==1 replace child_hhld = 2 if m02m_efvit==2 replace child_hhld = 3 if m02m_efvit==3 replace child_hhld = 4 if m02m_efvit==4 replace child_hhld = 5 if m02m_efvit==5 replace child_hhld = 6 if inlist(m02m_efvit,6,7) replace child_hhld = 6 if m02x_typqmere2m==3 & missing(child_hhld) replace child_hhld = 5 if m02x_typqmere2m==4 & missing(child_hhld) replace child_hhld = 3 if m02x_typqpecf2m==3 & missing(child_hhld) replace child_hhld = 6 if m02x_typqpecf2m==5 & missing(child_hhld) replace child_hhld = 5 if m02x_typqpecf2m==6 & missing(child_hhld) replace child_hhld = 2 if m02x_typqpecf2m==7 & missing(child_hhld) replace child_hhld = 6 if m02x_typqpecf2m==8 & missing(child_hhld) replace child_hhld = 5 if m02x_typqpecf2m==9 & missing(child_hhld) replace child_hhld = 1 if m02m_lientyp_4==1 & missing(child_hhld) replace child_hhld = 2 if !inlist(m02m_lientyp_4,1) & missing(child_hhld) label var child_hhld "person living with the child, 2 months" label define child_hhld 1 "both father and mother" 2 "mother" 3 "father" 4 "rotating custody" 5 "foster parents" 6 "at the hospital" label values child_hhld child_hhld tab child_hhld, missing *2.9. Person living with the child, 1 year g child_hhld1y = 1 if a01m_efvit==1 replace child_hhld1y = 2 if a01m_efvit==2 & missing(child_hhld1y) replace child_hhld1y = 3 if a01m_efvit==3 & missing(child_hhld1y) replace child_hhld1y = 4 if a01m_efvit==4 & missing(child_hhld1y) replace child_hhld1y = 5 if a01m_efvit==5 & missing(child_hhld1y) foreach i of numlist 4/10 { replace child_hhld1y = 1 if a01m_lientyp_`i'==1 & missing(child_hhld1y) } foreach i of numlist 4/10 { replace child_hhld1y = 2 if !inlist(a01m_lientyp_`i',1) & a01m_lientyp_3==2 & missing(child_hhld1y) } label var child_hhld1y "person living with the child, 1 year" label define child_hhld1y 1 "both father and mother" 2 "mother" 3 "father" 4 "rotating custody" 5 "foster parents" label values child_hhld1y child_hhld1y tab child_hhld1y, missing *** At least one grand-parent in the houshold, 2 months g grandpar_2m = . foreach i of numlist 4/11 { replace grandpar_2m = 1 if m02m_lientyp_`i'==8 | m02m_lientyp_`i'==9 replace grandpar_2m = 1 if inlist(m02p_lientyp_`i',8,9) & m02m_lientyp_4==1 } replace grandpar_2m = 1 if m02m_gdpardom==1 replace grandpar_2m = 1 if m02p_gdpardom==1 & m02m_lientyp_4==1 replace grandpar_2m = 1 if m02m_mendomgp==1 replace grandpar_2m = 1 if m02p_mendomgp==1 & m02m_lientyp_4==1 replace grandpar_2m = 1 if !inlist(m02m_gpmaterd,0,.) replace grandpar_2m = 1 if !inlist(m02p_gppaterd,0,.) & m02m_lientyp_4==1 foreach i of numlist 4/11 { replace grandpar_2m = 0 if !inlist(m02m_lientyp_`i',8,9) & !inlist(m02m_lientyp_3,.) & missing(grandpar_2m) replace grandpar_2m = 0 if !inlist(m02p_lientyp_`i',8,9) & m02m_lientyp_4==1 & missing(grandpar_2m) } replace grandpar_2m = 0 if inlist(m02m_gpmaterd,0) & missing(grandpar_2m) replace grandpar_2m = 0 if inlist(m02p_gppaterd,0) & m02m_lientyp_4==1 & missing(grandpar_2m) label var grandpar_2m "Having at least one grandparent in the household, 2 months" label define grandpar_2m 1 "Yes" 0 "No" label value grandpar_2m grandpar_2m tab grandpar_2m, missing *** At least one grand-parent in the houshold, 1 year *you need the variable child_hhld1y g grandpar_1y = . foreach i of numlist 4/10 { replace grandpar_1y = 1 if a01m_lientyp_`i'==8 | a01m_lientyp_`i'==9 replace grandpar_1y = 1 if inlist(a01p_lientyp_`i',8,9) & inlist(child_hhld1y,1,3,4) } foreach i of numlist 4/10 { replace grandpar_1y = 0 if !inlist(a01m_lientyp_`i',8,9) & !inlist(a01m_lientyp_3,.) & missing(grandpar_1y) replace grandpar_1y = 0 if !inlist(a01p_lientyp_`i',8,9) & inlist(child_hhld1y,1,3,4) & missing(grandpar_1y) } label var grandpar_1y "Having at least one grandparent in the household, 1 year" label define grandpar_1y 1 "Yes" 0 "No" label value grandpar_1y grandpar_1y tab grandpar_1y, missing *** Same sex couple, 2 months g samesex_2m = . foreach i of numlist 4/6 { replace samesex_2m = 1 if m02m_sexec1_`i'==2 & m02m_lientyp_`i'==7 & inlist(m02x_typqmere2m,1,2,3) //referent mother with a female partner } foreach i of numlist 4/7 { replace samesex_2m = 1 if m02p_sexec1_`i'==1 & m02p_lientyp_`i'==7 & inlist(m02x_typqpecf2m,1,2) //referent father with a male partner } replace samesex_2m = 0 if m02m_lientyp_3==2 & inlist(m02x_typqmere2m,1,2,3) & missing(samesex_2m) //referent mother who answered replace samesex_2m = 0 if m02p_lientyp_4==1 & inlist(m02x_typqpecf2m,1,2) & missing(samesex_2m) //referent father who answered label var samesex_2m "Same sex couple in the household, 2 months" label define samesex_2m 1 "Yes" 0 "No" label value samesex_2m samesex_2m tab samesex_2m, missing ***Same sex couple, 1 year g samesex_1y = . foreach i of numlist 4/10 { replace samesex_1y = 1 if a01m_sexe_`i'==2 & a01m_lientyp_`i'==7 & inlist(a01x_typqmere1a,1,2,3) //referent mother with a female partner } foreach i of numlist 4/8 { replace samesex_1y = 1 if a01p_sexe_`i'==1 & a01p_lientyp_`i'==7 & inlist(a01x_typqpecf1a,1,2) } replace samesex_1y = 0 if a01m_lientyp_3==2 & inlist(a01x_typqmere1a,1,2,3) & missing(samesex_1y) foreach i of numlist 4/10 { replace samesex_1y = 0 if a01p_lientyp_`i'==1 & inlist(a01x_typqpecf1a,1,2) & missing(samesex_1y) } label var samesex_1y "Same sex couple in the household, 1 year" label define samesex_1y 1 "Yes" 0 "No" label value samesex_1y samesex_1y tab samesex_1y, missing ***Living Apart Together (LAT), 2 mois *you need the variable child_hhld g lat_2m = . replace lat_2m = 1 if m02m_lientyp_3==2 & inlist(m02m_typolog_3,2,3,4,5) & inlist(child_hhld,1,5) //Parents in the same household, mother not permanently replace lat_2m = 1 if m02m_lientyp_3==2 & m02m_jouran_3<270 & inlist(child_hhld,1,5) //Parents in the same household, mother less than 270 days per year in hhld replace lat_2m = 1 if m02m_lientyp_3==2 & m02m_joursem_3<5 & inlist(child_hhld,1,5) //Parents in the same household, mother less than 5 days per week in hhld replace lat_2m = 1 if m02m_lientyp_3==2 & m02m_moisan_3<10 & inlist(child_hhld,1,5) //Parents in the same household, mother less than 10 months per year in hhld foreach i of numlist 3/6{ //3/10 replace lat_2m = 1 if m02p_lientyp_`i'==2 & inlist(m02p_typolog_`i',2,3,4,5) & inlist(child_hhld,1,5) //Parents in the same household, mother not permanently replace lat_2m = 1 if m02p_lientyp_`i'==2 & m02p_jouran_`i'<270 & inlist(child_hhld,1,5) //Parents in the same household, mother less than 270 days per year in hhld replace lat_2m = 1 if m02p_lientyp_`i'==2 & m02p_joursem_`i'<5 & inlist(child_hhld,1,5) //Parents in the same household, mother less than 5 days per week in hhld replace lat_2m = 1 if m02p_lientyp_`i'==2 & m02p_moisan_`i'<10 & inlist(child_hhld,1,5) //Parents in the same household, mother less than 10 months per year in hhld } replace lat_2m = 1 if m02m_lientyp_4==1 & inlist(m02m_typolog_4,2,3,4,5) & inlist(child_hhld,1,5) //Parents in the same household, father not permanently replace lat_2m = 1 if m02m_lientyp_4==1 & m02m_jouran_4<270 & inlist(child_hhld,1,5) //Parents in the same household, father less than 270 days per year in hhld replace lat_2m = 1 if m02m_lientyp_4==1 & m02m_joursem_4<5 & inlist(child_hhld,1,5) //Parents in the same household, father less than 5 days per week in hhld replace lat_2m = 1 if m02m_lientyp_4==1 & m02m_moisan_4<10 & inlist(child_hhld,1,5) //Parents in the same household, father less than 10 months per year in hhld replace lat_2m = 1 if m02p_lientyp_4==1 & inlist(m02p_typolog_4,2,3,4,5) & inlist(child_hhld,1,5) //Parents in the same household, father not permanently replace lat_2m = 1 if m02p_lientyp_4==1 & m02p_jouran_4<270 & inlist(child_hhld,1,5) //Parents in the same household, father less than 270 days per year in hhld replace lat_2m = 1 if m02p_lientyp_4==1 & m02p_joursem_4<5 & inlist(child_hhld,1,5) //Parents in the same household, father less than 5 days per week in hhld replace lat_2m = 1 if m02p_lientyp_4==1 & m02p_moisan_4<10 & inlist(child_hhld,1,5) //Parents in the same household, father less than 10 months per year in hhld foreach i of numlist 4/6{ replace lat_2m = 1 if m02m_lientyp_3==2 & inlist(m02m_typolog_3,2,3,4,5) & m02m_lientyp_`i'==7 & inlist(child_hhld,2,4) //Child with mother, partner in hhld, she not permanently replace lat_2m = 1 if m02m_lientyp_3==2 & m02m_jouran_3<270 & m02m_lientyp_`i'==7 & inlist(child_hhld,2,4) //Child with mother, partner in hhld, mother less than 270 days per year in hhld replace lat_2m = 1 if m02m_lientyp_3==2 & m02m_joursem_3<5 & m02m_lientyp_`i'==7 & inlist(child_hhld,2,4) //Child with mother, partner in hhld, mother less than 5 days per week in hhld replace lat_2m = 1 if m02m_lientyp_3==2 & m02m_moisan_3<10 & m02m_lientyp_`i'==7 & inlist(child_hhld,2,4) //Child with mother, partner in hhld, mother less than 10 months per year in hhld } foreach i of numlist 4/6{ replace lat_2m = 1 if m02m_lientyp_`i'==7 & inlist(m02m_typolog_`i',2,3,4,5) & inlist(child_hhld,2,4) //Child with mother, partner not permanently replace lat_2m = 1 if m02m_jouran_`i'<270 & m02m_lientyp_`i'==7 & inlist(child_hhld,2,4) //Child with mother, partner less than 270 days per year in hhld replace lat_2m = 1 if m02m_joursem_`i'<5 & m02m_lientyp_`i'==7 & inlist(child_hhld,2,4) //Child with mother, partner less than 5 days per week in hhld replace lat_2m = 1 if m02m_moisan_`i'<10 & m02m_lientyp_`i'==7 & inlist(child_hhld,2,4) //Child with mother, partner less than 10 months per year in hhld } replace lat_2m = 1 if m02m_couple2==1 & inlist(child_hhld,2,4,5) //there is not partner in hhld, but there is a relationship out of hhld replace lat_2m = 1 if inlist(m02m_situafamm,2,4,5,6) & inlist(child_hhld,1,2,4,5) foreach i of numlist 4/7{ replace lat_2m = 1 if m02p_lientyp_4==1 & inlist(m02p_typolog_4,2,3,4,5) & m02p_lientyp_`i'==7 & inlist(child_hhld,3) //child with father, partner in hhld, father not permanently replace lat_2m = 1 if m02p_lientyp_4==1 & m02p_jouran_4<270 & m02p_lientyp_`i'==7 & inlist(child_hhld,3) //child with father, partner in hhld, father less than 270 days per year in hhld replace lat_2m = 1 if m02p_lientyp_4==1 & m02p_joursem_4<5 & m02p_lientyp_`i'==7 & inlist(child_hhld,3) //child with father, partner in hhld, father less than 5 days per week in hhld replace lat_2m = 1 if m02p_lientyp_4==1 & m02p_moisan_4<10 & m02p_lientyp_`i'==7 & inlist(child_hhld,3) //child with father, partner in hhld, father less than 10 months per year in hhld } foreach i of numlist 4/6{ //4/7 replace lat_2m = 1 if m02p_lientyp_`i'==7 & inlist(m02p_typolog_`i',2,3,4,5) & inlist(child_hhld,3) //child with father, partner in hhld but not permanently replace lat_2m = 1 if m02p_jouran_`i'<270 & m02p_lientyp_`i'==7 & inlist(child_hhld,3) //child with father, partner less than 270 days per year in hhld replace lat_2m = 1 if m02p_joursem_`i'<5 & m02p_lientyp_`i'==7 & inlist(child_hhld,3) //child with father, partner less than 5 days per week in hhld replace lat_2m = 1 if m02p_moisan_`i'<10 & m02p_lientyp_`i'==7 & inlist(child_hhld,3) //child with father, partner less than 10 months per year in hhld } replace lat_2m = 1 if inlist(m02p_situafamp,2,4,5,6) & inlist(child_hhld,1,3,5) replace lat_2m = 1 if inlist(m02p_situafamp,2,4,5,6) & child_hhld==3 replace lat_2m = 0 if m02m_lientyp_3==2 & missing(lat_2m) replace lat_2m = 0 if m02p_lientyp_4==1 & missing(lat_2m) label var lat_2m "Couple Living Apart Together in hhld, 2 months" label define lat_2m 1 "Yes" 0 "No" label value lat_2m lat_2m tab lat_2m, missing ***Living Apart Together (LAT), 1 year *you need the variable child_hhld1y g lat_1y = . replace lat_1y = 1 if a01m_lientyp_3==2 & inlist(a01m_typolog_3,2,3,4,5) & inlist(child_hhld1y,1,5) //Parents in the same household, mother not permanently replace lat_1y = 1 if a01m_lientyp_3==2 & a01m_jouran_3<270 & inlist(child_hhld1y,1,5) //Parents in the same household, mother less than 270 days per year in hhld replace lat_1y = 1 if a01m_lientyp_3==2 & a01m_joursem_3<5 & inlist(child_hhld1y,1,5) //Parents in the same household, mother less than 5 days per week in hhld replace lat_1y = 1 if a01m_lientyp_3==2 & a01m_moisan_3<10 & inlist(child_hhld1y,1,5) //Parents in the same household, mother less than 10 months per year in hhld foreach i of numlist 3/10{ replace lat_1y = 1 if a01p_lientyp_`i'==2 & inlist(a01p_typolog_`i',2,3,4,5) & inlist(child_hhld1y,1,5) //Parents in the same household, mother not permanently replace lat_1y = 1 if a01p_lientyp_`i'==2 & a01p_jouran_`i'<270 & inlist(child_hhld1y,1,5) //Parents in the same household, mother less than 270 days per year in hhld replace lat_1y = 1 if a01p_lientyp_`i'==2 & a01p_joursem_`i'<5 & inlist(child_hhld1y,1,5) //Parents in the same household, mother less than 5 days per week in hhld replace lat_1y = 1 if a01p_lientyp_`i'==2 & a01p_moisan_`i'<10 & inlist(child_hhld1y,1,5) //Parents in the same household, mother less than 10 months per year in hhld } foreach i of numlist 4/10{ replace lat_1y = 1 if a01m_lientyp_`i'==1 & inlist(a01m_typolog_`i',2,3,4,5) & inlist(child_hhld1y,1,5) //Parents in the same household, father not permanently replace lat_1y = 1 if a01m_lientyp_`i'==1 & a01m_jouran_`i'<270 & inlist(child_hhld1y,1,5) //Parents in the same household, father less than 270 days per year in hhld replace lat_1y = 1 if a01m_lientyp_`i'==1 & a01m_joursem_`i'<5 & inlist(child_hhld1y,1,5) //Parents in the same household, father less than 5 days per week in hhld replace lat_1y = 1 if a01m_lientyp_`i'==1 & a01m_moisan_`i'<10 & inlist(child_hhld1y,1,5) //Parents in the same household, father less than 10 months per year in hhld } foreach i of numlist 4/10{ replace lat_1y = 1 if a01p_lientyp_`i'==1 & inlist(a01p_typolog_`i',2,3,4,5) & inlist(child_hhld1y,1,5) //Parents in the same household, father not permanently replace lat_1y = 1 if a01p_lientyp_`i'==1 & a01p_jouran_`i'<270 & inlist(child_hhld1y,1,5) //Parents in the same household, father less than 270 days per year in hhld replace lat_1y = 1 if a01p_lientyp_`i'==1 & a01p_joursem_`i'<5 & inlist(child_hhld1y,1,5) //Parents in the same household, father less than 5 days per week in hhld replace lat_1y = 1 if a01p_lientyp_`i'==1 & a01p_moisan_`i'<10 & inlist(child_hhld1y,1,5) //Parents in the same household, father less than 10 months per year in hhld } foreach i of numlist 4/10{ replace lat_1y = 1 if a01m_lientyp_3==2 & inlist(a01m_typolog_3,2,3,4,5) & a01m_lientyp_`i'==7 & inlist(child_hhld1y,2,4) //Child with mother, partner in hhld, she not permanently replace lat_1y = 1 if a01m_lientyp_3==2 & a01m_jouran_3<270 & a01m_lientyp_`i'==7 & inlist(child_hhld1y,2,4) //child with mother, partner in hhld, she less than 270 days per year in hhld replace lat_1y = 1 if a01m_lientyp_3==2 & a01m_joursem_3<5 & a01m_lientyp_`i'==7 & inlist(child_hhld1y,2,4) //child with mother, partner in hhld, she less than 5 days per week in hhld replace lat_1y = 1 if a01m_lientyp_3==2 & a01m_moisan_3<10 & a01m_lientyp_`i'==7 & inlist(child_hhld1y,2,4) //child with mother, partner in hhld, she less than 10 months per year in hhld } foreach i of numlist 4/10{ replace lat_1y = 1 if a01m_lientyp_`i'==7 & inlist(a01m_typolog_`i',2,3,4,5) & inlist(child_hhld1y,2,4) //Child with mother, partner not permanently replace lat_1y = 1 if a01m_lientyp_`i'==7 & a01m_jouran_`i'<270 & inlist(child_hhld1y,2,4) //child with mother, partner less than 270 days per year in hhld replace lat_1y = 1 if a01m_lientyp_`i'==7 & a01m_joursem_`i'<5 & inlist(child_hhld1y,2,4) //child with mother, partner less than 5 days per week in hhld replace lat_1y = 1 if a01m_lientyp_`i'==7 & a01m_moisan_`i'<10 & inlist(child_hhld1y,2,4) //child with mother, partner less than 10 months per year in hhld } replace lat_1y = 1 if a01m_couple2==1 & inlist(child_hhld1y,2,4,5) //there is not partner in hhld, but there is a relationship out of hhld replace lat_1y = 1 if inlist(a01m_situafamm,2,4,5,6) & inlist(child_hhld1y,1,2,4,5) foreach i of numlist 4/10{ replace lat_1y = 1 if a01p_lientyp_`i'==1 & inlist(a01p_typolog_`i',2,3,4,5) & a01p_couple1==1 & inlist(child_hhld1y,3) //child with father, partner in hhld, father not permanently replace lat_1y = 1 if a01p_lientyp_`i'==1 & a01p_jouran_`i'<270 & a01p_couple1==1 & inlist(child_hhld1y,3) //child with father, partner in hhld, he less than 270 days per year in hhld replace lat_1y = 1 if a01p_lientyp_`i'==1 & a01p_joursem_`i'<5 & a01p_couple1==1 & inlist(child_hhld1y,3) //child with father, partner in hhld, he less than 5 days per week in hhld replace lat_1y = 1 if a01p_lientyp_`i'==1 & a01p_moisan_`i'<10 & a01p_couple1==1 & inlist(child_hhld1y,3) //child with father, partner in hhld, he less than 10 months per year in hhld } foreach i of numlist 4/8{ replace lat_1y = 1 if a01p_lientyp_`i'==7 & inlist(a01p_typolog_`i',2,3,4,5) & inlist(child_hhld1y,3) //child with father, partner in hhld but not permanently replace lat_1y = 1 if a01p_lientyp_`i'==7 & a01p_jouran_`i'<270 & inlist(child_hhld1y,3) //child with father, partner less than 270 days per year in hhld replace lat_1y = 1 if a01p_lientyp_`i'==7 & a01p_joursem_`i'<5 & inlist(child_hhld1y,3) //child with father, partner less than 5 days per week in hhld replace lat_1y = 1 if a01p_lientyp_`i'==7 & a01p_moisan_`i'<10 & inlist(child_hhld1y,3) //child with father, partner less than 10 months per year in hhld } replace lat_1y = 1 if a01p_couple2==1 & inlist(child_hhld1y,3) //child with father,there is not partner in hhld, but there is a relationship out of hhld replace lat_1y = 1 if inlist(a01p_situafamp,2,4,5,6) & inlist(child_hhld1y,1,3,5) replace lat_1y = 1 if inlist(a01p_situafamp,2,4,5,6) & child_hhld1y==3 replace lat_1y = 0 if a01m_lientyp_3==2 & missing(lat_1y) replace lat_1y = 0 if a01p_lientyp_4==1 & missing(lat_1y) label var lat_1y "Couple Living Apart Together in hhld, 1 year" label define lat_1y 1 "Yes" 0 "No" label value lat_1y lat_1y tab lat_1y, missing **** Number of siblings, 2 months *you need months2 foreach i of numlist 3/12{ g enf_2m_`i' = . replace enf_2m_`i' = 1 if inlist(m02m_lientyp_`i',3,4,5,6) replace enf_2m_`i' = 0 if !missing(m02m_lientyp_`i') & missing(enf_2m_`i') replace enf_2m_`i' = 1 if inlist(m02p_lientyp_`i',3,4,5,6) & child_hhld==3 replace enf_2m_`i' = 0 if !missing(m02p_lientyp_`i') & missing(enf_2m_`i') & child_hhld==3 } egen sib_2m = rowtotal (enf_2m_4 - enf_2m_12) replace sib_2m = . if months2==0 label var sib_2m "Number of siblings, 2 months" tab sib_2m, missing **** Number of siblings, 1 year * you need year1 foreach i of numlist 3/10{ g enf_1y_`i' = . replace enf_1y_`i' = 1 if inlist(a01m_lientyp_`i',3,4,5,6) replace enf_1y_`i' = 0 if !missing(a01m_lientyp_`i') & missing(enf_1y_`i') replace enf_1y_`i' = 1 if inlist(a01p_lientyp_`i',3,4,5,6) & child_hhld1y==3 replace enf_1y_`i' = 0 if !missing(a01p_lientyp_`i') & missing(enf_1y_`i') & child_hhld1y==3 } egen sib_1y = rowtotal (enf_1y_4 - enf_1y_10) replace sib_1y = . if year1==0 label var sib_1y "Number of siblings, 1 year" tab sib_1y, missing tab sib_2m sib_1y ***********************3. SOCIO-ECONOMIC SITUATION***************************** ** Child age at 1 year survey (in days) *use "D:\Barbara Castillo Rico\2. Project\2. Data\1. Elfe\3. Data set\FINALbase160211.dta", clear //latest *Maternity *Vague 1 : 1er, 2, 3, 4, avril 2011 ; -> 2nd April 2011 *Vague 2 : 27, 28 juin, 1er, 2, 3, 4 juillet 2011 ; -> 1st July 2011 *Vague 3 : 27, 28, 29 septembre 1er, 2, 3, 4, octobre 2011 ; -> 1st October 2011 *Vague 4 : 28, 29, 30 novembre et 1, 2, 3, 4 et 5 décembre 2011. -> 1st December *1 year *Vague 1 : du 11 mai au 30 juillet 2012 - 1y and 1m – 1y and 4m -> 21 May, 15 June, 15 July. *Vague 2 : du 29 juin au 28 septembre 2012 - 1y – 1y and 3m -> 29 June, 15 July, 15 August, 14 Sept. *Vague 3 : du 28 septembre 2012 au 19 décembre 2012 - 1y – 1y and 3m -> 29 Sept, 15 Oct, 15 Nov, 10 Dic. *Vague 4 : du 28 novembre 2012 au 1er mars 2013 - 1y – 1y and 3m -> 29 Nov, 15 Dic, 15 Jan, 14 Feb, 1st March. * Set birth date -> day, month, year g day = 2 if m00m1_vague==1 replace day = 1 if inlist(m00m1_vague,2,3,4) g month = 4 if m00m1_vague==1 replace month = 7 if m00m1_vague==2 replace month = 10 if m00m1_vague==3 replace month = 12 if m00m1_vague==4 g year = 2011 if !missing(m00m1_vague) * Set 1 year questionnaire date -> day, month, year g month_1y = a01m_datintm g year_1y = a01m_datinta g day_1y = 21 if month_1y==5 & a01m_vague==1 replace day_1y = 15 if month_1y==6 & a01m_vague==1 replace day_1y = 15 if month_1y==7 & a01m_vague==1 replace day_1y = 29 if month_1y==6 & a01m_vague==2 replace day_1y = 15 if month_1y==7 & a01m_vague==2 replace day_1y = 15 if month_1y==8 & a01m_vague==2 replace day_1y = 14 if month_1y==9 & a01m_vague==2 replace day_1y = 29 if month_1y==9 & a01m_vague==3 replace day_1y = 15 if month_1y==10 & a01m_vague==3 replace day_1y = 15 if month_1y==11 & a01m_vague==3 replace day_1y = 10 if month_1y==12 & a01m_vague==3 replace day_1y = 29 if month_1y==11 & a01m_vague==4 replace day_1y = 15 if month_1y==12 & a01m_vague==4 replace day_1y = 15 if month_1y==1 & a01m_vague==4 replace day_1y = 14 if month_1y==2 & a01m_vague==4 replace day_1y = 1 if month_1y==3 & a01m_vague==4 gen date = mdy(month, day, year) gen date_1y = mdy(month_1y, day_1y, year_1y) g age_1y = date_1y - date tab age_1y g agemois_1y = age_1y/30 label var agemois_1y "Child's age at questionnaire, 1 year" tab agemois_1y, missing ***. Mother's age, 2 months g m_age_2m = m00m2_agem + 0.166 replace m_age_2m = m02m_age_3 if missing(m_age_2m) replace m_age_2m = 2011 - m02m_anais_3 if missing(m_age_2m) foreach i of numlist 3/10{ replace m_age_2m = m02p_age_`i' if m02p_lientyp_`i'==2 & missing(m_age_2m) } foreach i of numlist 3/10{ replace m_age_2m = 2011 - m02p_anais_`i' if m02p_lientyp_`i'==2 & missing(m_age_2m) } replace m_age_2m = round(m_age_2m,1) if !missing(m_age_2m) replace m_age_2m = . if m_age_2m<18 & !missing(m_age_2m) label var m_age_2m "Mother's age, 2 months" tab m_age_2m, missing g m_ageg_2m = 1 if m_age_2m<26 & !missing(m_age_2m) replace m_ageg_2m = 2 if m_age_2m>25.9 & m_age_2m<31 replace m_ageg_2m = 3 if m_age_2m>30.9 & m_age_2m<36 replace m_ageg_2m = 4 if m_age_2m>35.9 & m_age_2m<41 replace m_ageg_2m = 5 if m_age_2m>40.9 & !missing(m_age_2m) label var m_ageg_2m "Mother's age by group, 2 months" label define m_ageg_2m 1 ">=25" 2 "26-30" 3 "31-35" 4 "36-40" 5 ">40" label value m_ageg_2m m_ageg_2m tab m_ageg_2m, missing ***. Mother's age, 1 year *you need m_age_2m g m_age_1y = a01m_age_3 replace m_age_1y = m_age_2m - 0.166 + (agemois_1y/12) if missing(m_age_1y) replace m_age_1y = 2012 - a01m_anais_3 if missing(m_age_1y) & a01m_datinta==2012 //some questionnaires were done in early 2013 replace m_age_1y = 2013 - a01m_anais_3 if missing(m_age_1y) & a01m_datinta==2013 foreach i of numlist 3/10{ replace m_age_1y = a01p_age_`i' if a01p_lientyp_`i'==2 & missing(m_age_1y) } foreach i of numlist 3/10{ replace m_age_1y = 2012 - a01p_anais_`i' if a01p_lientyp_`i'==2 & missing(m_age_1y) & a01m_datinta==2012 //some questionnaires were done in early 2013 replace m_age_1y = 2013 - a01p_anais_`i' if a01p_lientyp_`i'==2 & missing(m_age_1y) & a01m_datinta==2013 } replace m_age_1y = m_age_2m + 1 if missing(m_age_1y) //we do not know agemois_1y for some replace m_age_1y = round(m_age_1y,1) if !missing(m_age_1y) replace m_age_1y = . if m_age_1y<18 & !missing(m_age_1y) label var m_age_1y "Mother's age, 1 year" tab m_age_1y, missing g m_ageg_1y = 1 if m_age_1y<26 & !missing(m_age_1y) replace m_ageg_1y = 2 if m_age_1y>25.9 & m_age_1y<31 replace m_ageg_1y = 3 if m_age_1y>30.9 & m_age_1y<36 replace m_ageg_1y = 4 if m_age_1y>35.9 & m_age_1y<41 replace m_ageg_1y = 5 if m_age_1y>40.9 & !missing(m_age_1y) label var m_ageg_1y "Mother's age by group, 1 year" label define m_ageg_1y 1 ">=25" 2 "26-30" 3 "31-35" 4 "36-40" 5 ">40" label value m_ageg_1y m_ageg_1y tab m_ageg_1y, missing ***. Father's age, 2 months g f_age_2m = m00m2_agep + 0.166 replace f_age_2m = m02p_age_4 if m02p_lientyp_4==1 & missing(f_age_2m) replace f_age_2m = 2011 - m02p_anais_4 if m02p_lientyp_4==1 & missing(f_age_2m) replace f_age_2m = m02m_age_4 if m02m_lientyp_4==1 & missing(f_age_2m) replace f_age_2m = 2011 - m02m_anais_4 if m02m_lientyp_4==1 & missing(f_age_2m) replace f_age_2m = round(f_age_2m,1) if !missing(f_age_2m) replace f_age_2m = . if f_age_2m<14 & !missing(f_age_2m) label var f_age_2m "Father's age, 2 months" tab f_age_2m, missing g f_ageg_2m = 1 if f_age_2m<26 & !missing(f_age_2m) replace f_ageg_2m = 2 if f_age_2m>25.9 & f_age_2m<31 replace f_ageg_2m = 3 if f_age_2m>30.9 & f_age_2m<36 replace f_ageg_2m = 4 if f_age_2m>35.9 & f_age_2m<41 replace f_ageg_2m = 5 if f_age_2m>40.9 & !missing(f_age_2m) label var f_ageg_2m "Father's age by group, 2 months" label define f_ageg_2m 1 ">=25" 2 "26-30" 3 "31-35" 4 "36-40" 5 ">40" label value f_ageg_2m f_ageg_2m tab f_ageg_2m, missing ***. Father's age, 1 year *You need f_age_2m g f_age_1y = . foreach i of numlist 4/10{ replace f_age_1y = a01p_age_`i' if a01p_lientyp_`i'==1 replace f_age_1y = 2012 - a01p_anais_`i' if missing(f_age_1y) & a01p_lientyp_`i'==1 & a01m_datinta==2012 replace f_age_1y = 2013 - a01p_anais_`i' if missing(f_age_1y) & a01p_lientyp_`i'==1 & a01m_datinta==2013 replace f_age_1y = f_age_2m - 0.166 + (agemois_1y/12) if missing(f_age_1y) replace f_age_1y = a01m_age_`i' if a01m_lientyp_`i'==1 & missing(f_age_1y) replace f_age_1y = 2012 - a01m_anais_`i' if missing(f_age_1y) & a01m_lientyp_`i'==1 & a01m_datinta==2012 replace f_age_1y = 2013 - a01m_anais_`i' if missing(f_age_1y) & a01m_lientyp_`i'==1 & a01m_datinta==2013 replace f_age_1y = f_age_2m + 1 if missing(f_age_1y) } replace f_age_1y = round(f_age_1y,1) if !missing(f_age_1y) replace f_age_1y = . if f_age_1y<14 & !missing(f_age_1y) label var f_age_1y "Father's age, 1 year" tab f_age_1y, missing g f_ageg_1y = 1 if f_age_1y<26 & !missing(f_age_1y) replace f_ageg_1y = 2 if f_age_1y>25.9 & f_age_1y<31 replace f_ageg_1y = 3 if f_age_1y>30.9 & f_age_1y<36 replace f_ageg_1y = 4 if f_age_1y>35.9 & f_age_1y<41 replace f_ageg_1y = 5 if f_age_1y>40.9 & !missing(f_age_1y) label var f_ageg_1y "Mother's age by group, 1 year" label define f_ageg_1y 1 ">=25" 2 "26-30" 3 "31-35" 4 "36-40" 5 ">40" label value f_ageg_1y f_ageg_1y tab f_ageg_1y, missing *** Age difference between mother and father g agedif = f_age_2m - m_age_2m label var agedif "Age difference between mother and father (f-m)" sum agedif *3.1 Mother's education g meduc = . replace meduc=0 if m02m_diplome_3==1 replace meduc=1 if m02m_diplome_3==2 replace meduc=2 if m02m_diplome_3==3 replace meduc=3 if inlist(m02m_diplome_3, 4, 5, 6) replace meduc=4 if inlist(m02m_diplome_3, 7) replace meduc=5 if inlist(m02m_diplome_3, 8) replace meduc=0 if a01m_diplome_3==1 & meduc==. replace meduc=1 if a01m_diplome_3==2 & inlist(meduc,0,.) replace meduc=2 if a01m_diplome_3==3 & inlist(meduc,.,0,1) replace meduc=3 if inlist(a01m_diplome_3, 4, 5, 6) & inlist(meduc,.,0,1,2) replace meduc=4 if inlist(a01m_diplome_3, 7) & inlist(meduc,.,0,1,2,3) replace meduc=5 if inlist(a01m_diplome_3, 8) & inlist(meduc,.,0,1,2,3,4) foreach i of numlist 3/10{ replace meduc=0 if m02p_diplome_`i'==1 & missing(meduc) & m02p_lientyp_`i'==2 replace meduc=1 if m02p_diplome_`i'==2 & missing(meduc) & m02p_lientyp_`i'==2 replace meduc=2 if m02p_diplome_`i'==3 & missing(meduc) & m02p_lientyp_`i'==2 replace meduc=3 if inlist(m02p_diplome_`i', 4, 5, 6) & missing(meduc) & m02p_lientyp_`i'==2 replace meduc=4 if inlist(m02p_diplome_`i', 7) & missing(meduc) & m02p_lientyp_`i'==2 replace meduc=5 if inlist(m02p_diplome_`i', 8) & missing(meduc) & m02p_lientyp_`i'==2 } foreach i of numlist 3/10{ replace meduc=0 if a01p_diplome_`i'==1 & missing(meduc) & a01p_lientyp_`i'==2 replace meduc=1 if a01p_diplome_`i'==2 & inlist(meduc,0,.) & a01p_lientyp_`i'==2 replace meduc=2 if a01p_diplome_`i'==3 & inlist(meduc,.,0,1) & a01p_lientyp_`i'==2 replace meduc=3 if inlist(a01p_diplome_`i', 4, 5, 6) & inlist(meduc,.,0,1,2) & a01p_lientyp_`i'==2 replace meduc=4 if inlist(a01p_diplome_`i', 7) & inlist(meduc,.,0,1,2,3) & a01p_lientyp_`i'==2 replace meduc=5 if inlist(a01p_diplome_`i', 8) & inlist(meduc,.,0,1,2,3,4) & a01p_lientyp_`i'==2 } label var meduc "mother's educational attainment - isced" label define meduc 0 "none" 1 "primary" 2 "lower secondary" 3 "upper secondary" 4 "intermediate" 5 "higher" label values meduc meduc tab meduc, missing *3.2 Father's education g feduc = . replace feduc=0 if m02p_diplome_4==1 & m02p_lientyp_4==1 replace feduc=1 if m02p_diplome_4==2 & m02p_lientyp_4==1 replace feduc=2 if m02p_diplome_4==3 & m02p_lientyp_4==1 replace feduc=3 if inlist(m02p_diplome_4, 4, 5, 6) & m02p_lientyp_4==1 replace feduc=4 if inlist(m02p_diplome_4, 7) & m02p_lientyp_4==1 replace feduc=5 if inlist(m02p_diplome_4, 8) & m02p_lientyp_4==1 foreach i of numlist 4/10{ replace feduc=0 if a01p_diplome_`i'==1 & a01p_lientyp_`i'==1 & inlist(feduc,.) replace feduc=1 if a01p_diplome_`i'==2 & a01p_lientyp_`i'==1 & inlist(feduc,.,0) replace feduc=2 if a01p_diplome_`i'==3 & a01p_lientyp_`i'==1 & inlist(feduc,.,0,1) replace feduc=3 if inlist(a01p_diplome_`i', 4, 5, 6) & a01p_lientyp_`i'==1 & inlist(feduc,.,0,1,2) replace feduc=4 if inlist(a01p_diplome_`i', 7) & a01p_lientyp_`i'==1 & inlist(feduc,.,0,1,2,3) replace feduc=5 if inlist(a01p_diplome_`i', 8) & a01p_lientyp_`i'==1 & inlist(feduc,.,0,1,2,3,4) } replace feduc=0 if m02m_diplome_4==1 & missing(feduc) & m02m_lientyp_4==1 replace feduc=1 if m02m_diplome_4==2 & missing(feduc) & m02m_lientyp_4==1 replace feduc=2 if m02m_diplome_4==3 & missing(feduc) & m02m_lientyp_4==1 replace feduc=3 if inlist(m02m_diplome_4, 4, 5, 6) & missing(feduc) & m02m_lientyp_4==1 replace feduc=4 if inlist(m02m_diplome_4, 7) & missing(feduc) & m02m_lientyp_4==1 replace feduc=5 if inlist(m02m_diplome_4, 8) & missing(feduc) & m02m_lientyp_4==1 foreach i of numlist 4/10{ replace feduc=0 if a01m_diplome_`i'==1 & a01m_lientyp_`i'==1 & inlist(feduc,.) replace feduc=1 if a01m_diplome_`i'==2 & a01m_lientyp_`i'==1 & inlist(feduc,.,0) replace feduc=2 if a01m_diplome_`i'==3 & a01m_lientyp_`i'==1 & inlist(feduc,.,0,1) replace feduc=3 if inlist(a01m_diplome_`i', 4, 5, 6) & a01m_lientyp_`i'==1 & inlist(feduc,.,0,1,2) replace feduc=4 if inlist(a01m_diplome_`i', 7) & a01m_lientyp_`i'==1 & inlist(feduc,.,0,1,2,3) replace feduc=5 if inlist(a01m_diplome_`i', 8) & a01m_lientyp_`i'==1 & inlist(feduc,.,0,1,2,3,4) } label var feduc "father's educational attainment - isced" label define feduc 0 "none" 1 "primary" 2 "lower secondary" 3 "upper secondary" 4 "intermediate" 5 "higher" label values feduc feduc tab feduc, missing *** Mother's partner education (father or conjoint), 2 months g mpeduc_2m = feduc if m02m_lientyp_4==1 foreach i of numlist 4/6{ replace mpeduc_2m = 0 if m02m_lientyp_`i'==7 & m02m_diplome_`i'==1 & missing(mpeduc_2m) replace mpeduc_2m = 1 if m02m_lientyp_`i'==7 & m02m_diplome_`i'==2 & missing(mpeduc_2m) replace mpeduc_2m = 2 if m02m_lientyp_`i'==7 & m02m_diplome_`i'==3 & missing(mpeduc_2m) replace mpeduc_2m = 3 if m02m_lientyp_`i'==7 & inlist(m02m_diplome_`i',4,5,6) & missing(mpeduc_2m) replace mpeduc_2m = 4 if m02m_lientyp_`i'==7 & m02m_diplome_`i'==7 & missing(mpeduc_2m) replace mpeduc_2m = 5 if m02m_lientyp_`i'==7 & m02m_diplome_`i'==8 & missing(mpeduc_2m) } label var mpeduc_2m "Mother's partner educational attainment - isced (father or current partner at 2 months)" label define mpeduc_2m 0 "none" 1 "primary" 2 "lower secondary" 3 "upper secondary" 4 "intermediate" 5 "higher" label values mpeduc_2m mpeduc_2m tab mpeduc_2m, missing *** Mother's partner education (father or conjoint), 1 year g mpeduc_1y = . foreach i of numlist 4/10{ replace mpeduc_1y = feduc if a01m_lientyp_`i'==1 replace mpeduc_1y = 0 if a01m_lientyp_`i'==7 & a01m_diplome_`i'==1 & missing(mpeduc_1y) replace mpeduc_1y = 1 if a01m_lientyp_`i'==7 & a01m_diplome_`i'==2 & missing(mpeduc_1y) replace mpeduc_1y = 2 if a01m_lientyp_`i'==7 & a01m_diplome_`i'==3 & missing(mpeduc_1y) replace mpeduc_1y = 3 if a01m_lientyp_`i'==7 & inlist(a01m_diplome_`i',4,5,6) & missing(mpeduc_1y) replace mpeduc_1y = 4 if a01m_lientyp_`i'==7 & a01m_diplome_`i'==7 & missing(mpeduc_1y) replace mpeduc_1y = 5 if a01m_lientyp_`i'==7 & a01m_diplome_`i'==8 & missing(mpeduc_1y) } label var mpeduc_1y "Mother's partner educational attainment - isced (father or current partner at 1 year)" label define mpeduc_1y 0 "none" 1 "primary" 2 "lower secondary" 3 "upper secondary" 4 "intermediate" 5 "higher" label values mpeduc_1y mpeduc_1y tab mpeduc_1y, missing *** Father's partner education (mother or conjoint), 2 months g fpeduc_2m = . foreach i of numlist 3/10{ replace fpeduc_2m = meduc if m02p_lientyp_`i'==2 replace fpeduc_2m = 0 if m02p_lientyp_`i'==7 & m02p_diplome_`i'==1 & missing(fpeduc_2m) replace fpeduc_2m = 1 if m02p_lientyp_`i'==7 & m02p_diplome_`i'==2 & missing(fpeduc_2m) replace fpeduc_2m = 2 if m02p_lientyp_`i'==7 & m02p_diplome_`i'==3 & missing(fpeduc_2m) replace fpeduc_2m = 3 if m02p_lientyp_`i'==7 & inlist(m02p_diplome_`i',4,5,6) & missing(fpeduc_2m) replace fpeduc_2m = 4 if m02p_lientyp_`i'==7 & m02p_diplome_`i'==7 & missing(fpeduc_2m) replace fpeduc_2m = 5 if m02p_lientyp_`i'==7 & m02p_diplome_`i'==8 & missing(fpeduc_2m) } label var fpeduc_2m "father's partner educational attainment - isced (mother or current partner at 2 months)" label define fpeduc_2m 0 "none" 1 "primary" 2 "lower secondary" 3 "upper secondary" 4 "intermediate" 5 "higher" label values fpeduc_2m fpeduc_2m tab fpeduc_2m, missing *** Father's partner education (mother or conjoint), 1 year g fpeduc_1y = . foreach i of numlist 3/10{ replace fpeduc_1y = meduc if a01p_lientyp_`i'==2 replace fpeduc_1y = 0 if a01p_lientyp_`i'==7 & a01p_diplome_`i'==1 & missing(fpeduc_1y) replace fpeduc_1y = 1 if a01p_lientyp_`i'==7 & a01p_diplome_`i'==2 & missing(fpeduc_1y) replace fpeduc_1y = 2 if a01p_lientyp_`i'==7 & a01p_diplome_`i'==3 & missing(fpeduc_1y) replace fpeduc_1y = 3 if a01p_lientyp_`i'==7 & inlist(a01p_diplome_`i',4,5,6) & missing(fpeduc_1y) replace fpeduc_1y = 4 if a01p_lientyp_`i'==7 & a01p_diplome_`i'==7 & missing(fpeduc_1y) replace fpeduc_1y = 5 if a01p_lientyp_`i'==7 & a01p_diplome_`i'==8 & missing(fpeduc_1y) } label var fpeduc_1y "father's partner educational attainment - isced (mother or current partner at 1 year)" label define fpeduc_1y 0 "none" 1 "primary" 2 "lower secondary" 3 "upper secondary" 4 "intermediate" 5 "higher" label values fpeduc_1y fpeduc_1y tab fpeduc_1y, missing *** Educational gap between father and mother g educfm = feduc - meduc g educdiff = 2 if educfm>0 & !missing(educfm) //father > mother replace educdiff = 1 if educfm==0 & !missing(educfm) //father = mother replace educdiff = 3 if educfm<0 & !missing(educfm) //mother > father label var educdiff "Educational gap between father and mother (f-m)" label define educdiff 1 "Father = Mother" 2 "Father > Mother" 3 "Mother > Father" label value educdiff educdiff tab educdiff, missing *** Educational gap between household cohabiting parters, 2 months g educpm_2m = feduc - meduc if inlist(child_hhld,1,4,5,6) replace educpm_2m = mpeduc_2m - meduc if inlist(child_hhld,2) replace educpm_2m = feduc - fpeduc_2m if inlist(child_hhld,3) g educdiff_2m = 2 if educpm_2m>0 & !missing(educpm_2m) //father > mother // conjoint > mother // father > conjoint replace educdiff_2m = 1 if educpm_2m==0 & !missing(educpm_2m) //father = mother // conjoint = mother // father = conjoint replace educdiff_2m = 3 if educpm_2m<0 & !missing(educpm_2m) //father < mother // conjoint < mother // father < conjoint label var educdiff_2m "Educational gap between household cohabiting partners (father-mother/conj-mother/father-conj)" label define educdiff_2m 1 "Father = Mother" 2 "Father > Mother" 3 "Mother > Father" label value educdiff_2m educdiff_2m tab educdiff_2m, missing *** Educational gap between household cohabiting parters, 1 year g educpm_1y = feduc - meduc if inlist(child_hhld1y,1,4,5,6) //father and mother if child with them replace educpm_1y = mpeduc_1y - meduc if inlist(child_hhld1y,2) //mother and partner if child with mother replace educpm_1y = feduc - fpeduc_1y if inlist(child_hhld1y,3) //father and partner if child with father g educdiff_1y = 2 if educpm_1y>0 & !missing(educpm_1y) //father > mother // conjoint > mother // father > conjoint replace educdiff_1y = 1 if educpm_1y==0 & !missing(educpm_1y) //father = mother // conjoint = mother // father = conjoint replace educdiff_1y = 3 if educpm_1y<0 & !missing(educpm_1y) //father < mother // conjoint < mother // father < conjoint label var educdiff_1y "Educational gap between household cohabiting partners (father-mother/conj-mother/father-conj)" label define educdiff_1y 1 "Father = Mother" 2 "Father > Mother" 3 "Mother > Father" label value educdiff_1y educdiff_1y tab educdiff_1y, missing *3.3 Mother's education - french system g mother_educationfrench=. replace mother_educationfrench=1 if m02m_diplome_3==1 replace mother_educationfrench=1 if m02m_diplome_3==2 replace mother_educationfrench=1 if m02m_diplome_3==3 replace mother_educationfrench=2 if inlist(m02m_diplome_3, 4) replace mother_educationfrench=3 if inlist(m02m_diplome_3, 5, 6) replace mother_educationfrench=4 if inlist(m02m_diplome_3, 7) replace mother_educationfrench=5 if inlist(m02m_diplome_3, 8) replace mother_educationfrench=1 if inlist(a01m_diplome_3,1,2,3) & inlist(mother_educationfrench,.) replace mother_educationfrench=2 if inlist(a01m_diplome_3, 4) & inlist(mother_educationfrench,.,1) replace mother_educationfrench=3 if inlist(a01m_diplome_3, 5, 6) & inlist(mother_educationfrench,.,1,2) replace mother_educationfrench=4 if inlist(a01m_diplome_3, 7) & inlist(mother_educationfrench,.,1,2,3) replace mother_educationfrench=5 if inlist(a01m_diplome_3, 8) & inlist(mother_educationfrench,.,1,2,3,4) foreach i of numlist 3/10{ replace mother_educationfrench=1 if m02p_diplome_`i'==1 & missing(mother_educationfrench) & m02p_lientyp_`i'==2 replace mother_educationfrench=1 if m02p_diplome_`i'==2 & missing(mother_educationfrench) & m02p_lientyp_`i'==2 replace mother_educationfrench=1 if m02p_diplome_`i'==3 & missing(mother_educationfrench) & m02p_lientyp_`i'==2 replace mother_educationfrench=2 if inlist(m02p_diplome_`i', 4) & missing(mother_educationfrench) & m02p_lientyp_`i'==2 replace mother_educationfrench=3 if inlist(m02p_diplome_`i', 5, 6) & missing(mother_educationfrench) & m02p_lientyp_`i'==2 replace mother_educationfrench=4 if inlist(m02p_diplome_`i', 7) & missing(mother_educationfrench) & m02p_lientyp_`i'==2 replace mother_educationfrench=5 if inlist(m02p_diplome_`i', 8) & missing(mother_educationfrench) & m02p_lientyp_`i'==2 } foreach i of numlist 3/10{ replace mother_educationfrench=1 if inlist(a01p_diplome_`i',1,2,3) & missing(mother_educationfrench) & a01p_lientyp_`i'==2 replace mother_educationfrench=2 if inlist(a01p_diplome_`i', 4) & missing(mother_educationfrench) & a01p_lientyp_`i'==2 replace mother_educationfrench=3 if inlist(a01p_diplome_`i', 5, 6) & missing(mother_educationfrench) & a01p_lientyp_`i'==2 replace mother_educationfrench=4 if inlist(a01p_diplome_`i', 7) & missing(mother_educationfrench) & a01p_lientyp_`i'==2 replace mother_educationfrench=5 if inlist(a01p_diplome_`i', 8) & missing(mother_educationfrench) & a01p_lientyp_`i'==2 } label var mother_educationfrench "mother's educational attainment - french" label define mother_educationfrench 1 "<=bepc" 2 "cap-bep" 3 "bac" 4 "bac +2" 5 ">bac +2" label values mother_educationfrench mother_educationfrench rename mother_educationfrench meducaf ta meducaf, missing *3.4 Father's education - french system g feducaf=. replace feducaf=1 if inlist(m02p_diplome_4,1,2,3) & m02p_lientyp_4==1 replace feducaf=2 if inlist(m02p_diplome_4, 4) & m02p_lientyp_4==1 replace feducaf=3 if inlist(m02p_diplome_4, 5, 6) & m02p_lientyp_4==1 replace feducaf=4 if inlist(m02p_diplome_4, 7) & m02p_lientyp_4==1 replace feducaf=5 if inlist(m02p_diplome_4, 8) & m02p_lientyp_4==1 foreach i of numlist 4/10{ replace feducaf=1 if inlist(a01p_diplome_`i',1,2,3) & a01p_lientyp_`i'==1 & inlist(feducaf,.) replace feducaf=2 if inlist(a01p_diplome_`i', 4) & a01p_lientyp_`i'==1 & inlist(feducaf,.,1) replace feducaf=3 if inlist(a01p_diplome_`i', 5, 6) & a01p_lientyp_`i'==1 & inlist(feducaf,.,1,2) replace feducaf=4 if inlist(a01p_diplome_`i', 7) & a01p_lientyp_`i'==1 & inlist(feducaf,.,1,2,3) replace feducaf=5 if inlist(a01p_diplome_`i', 8) & a01p_lientyp_`i'==1 & inlist(feducaf,.,1,2,3,4) } replace feducaf=1 if inlist(m02m_diplome_4,1,2,3) & missing(feducaf) & m02m_lientyp_4==1 replace feducaf=2 if m02m_diplome_4==4 & missing(feducaf) & m02m_lientyp_4==1 replace feducaf=3 if inlist(m02m_diplome_4,5,6) & missing(feducaf) & m02m_lientyp_4==1 replace feducaf=4 if m02m_diplome_4==7 & missing(feducaf) & m02m_lientyp_4==1 replace feducaf=5 if m02m_diplome_4==8 & missing(feducaf) & m02m_lientyp_4==1 foreach i of numlist 4/10{ replace feducaf=1 if inlist(a01m_diplome_`i',1,2,3) & missing(feducaf) & a01m_lientyp_`i'==1 replace feducaf=2 if a01m_diplome_`i'==4 & missing(feducaf) & a01m_lientyp_`i'==1 replace feducaf=3 if inlist(a01m_diplome_`i',5,6) & missing(feducaf) & a01m_lientyp_`i'==1 replace feducaf=4 if a01m_diplome_`i'==7 & missing(feducaf) & a01m_lientyp_`i'==1 replace feducaf=5 if a01m_diplome_`i'==8 & missing(feducaf) & a01m_lientyp_`i'==1 } label var feducaf "father's educational attainment - french" label define feducaf 1 "<=bepc" 2 "cap-bep" 3 "bac" 4 "bac +2" 5 ">bac +2" label values feducaf feducaf tab feducaf, missing *3.5 Mother's occupational status, 2 months g mother_occup_status=. replace mother_occup_status=4 if m02m_etudes_3==1 //student replace mother_occup_status=4 if !missing(m02m_situae_3) replace mother_occup_status=1 if m02m_situa_3==1 replace mother_occup_status=4 if m02m_situa_3==2 replace mother_occup_status=2 if m02m_situa_3==3 replace mother_occup_status=3 if m02m_situa_3==4 replace mother_occup_status=3 if m02m_situa_3==5 replace mother_occup_status=3 if m02m_situa_3==6 replace mother_occup_status=3 if m02m_situa_3==7 foreach i of numlist 3/10{ replace mother_occup_status=4 if m02p_etudes_`i'==1 & m02p_lientyp_`i'==2 & missing(mother_occup_status) replace mother_occup_status=4 if !missing(m02p_situae_`i') & m02p_lientyp_`i'==2 & missing(mother_occup_status) replace mother_occup_status=1 if m02p_situa_`i'==1 & m02p_lientyp_`i'==2 & missing(mother_occup_status) replace mother_occup_status=4 if m02p_situa_`i'==2 & m02p_lientyp_`i'==2 & missing(mother_occup_status) replace mother_occup_status=2 if m02p_situa_`i'==3 & m02p_lientyp_`i'==2 & missing(mother_occup_status) replace mother_occup_status=3 if m02p_situa_`i'==4 & m02p_lientyp_`i'==2 & missing(mother_occup_status) replace mother_occup_status=3 if m02p_situa_`i'==5 & m02p_lientyp_`i'==2 & missing(mother_occup_status) replace mother_occup_status=3 if m02p_situa_`i'==6 & m02p_lientyp_`i'==2 & missing(mother_occup_status) replace mother_occup_status=3 if m02p_situa_`i'==7 & m02p_lientyp_`i'==2 & missing(mother_occup_status) } replace mother_occup_status=1 if m02m_congmatpar_3==1 & missing(mother_occup_status) replace mother_occup_status=3 if m02m_congmatpar_3==2 & missing(mother_occup_status) replace mother_occup_status=1 if m02m_congmatpar_3==3 & missing(mother_occup_status) foreach i of numlist 3/10{ replace mother_occup_status=1 if m02p_congmatpar_`i'==1 & m02p_lientyp_`i'==2 & missing(mother_occup_status) replace mother_occup_status=3 if m02p_congmatpar_`i'==2 & m02p_lientyp_`i'==2 & missing(mother_occup_status) replace mother_occup_status=1 if m02p_congmatpar_`i'==3 & m02p_lientyp_`i'==2 & missing(mother_occup_status) } label var mother_occup_status "mother's occupational status, 2 months" label define mother_occup_status 1 "employed" 2 "unemployed" 3 "other situation (incl. housewife, retired, handicapped pension)" 4 "student, apprentice, intern" label values mother_occup_status mother_occup_status tab mother_occup_status, missing *3.6. Mother's occupational status, 1 year g mother_occup_status1y = . replace mother_occup_status1y = 4 if a01m_etudes_3==1 & missing(mother_occup_status1y) replace mother_occup_status1y = 4 if !missing(a01m_situae_3) & missing(mother_occup_status1y) replace mother_occup_status1y = 1 if a01m_situa_3==1 & missing(mother_occup_status1y) replace mother_occup_status1y = 4 if a01m_situa_3==2 & missing(mother_occup_status1y) replace mother_occup_status1y = 2 if a01m_situa_3==3 & missing(mother_occup_status1y) replace mother_occup_status1y = 3 if inlist(a01m_situa_3,4,5,6,7) & missing(mother_occup_status1y) foreach i of numlist 3/10{ replace mother_occup_status1y = 4 if a01p_etudes_`i'==1 & a01p_lientyp_`i'==2 & missing(mother_occup_status1y) replace mother_occup_status1y = 4 if !missing(a01p_situae_`i') & a01p_lientyp_`i'==2 & missing(mother_occup_status1y) replace mother_occup_status1y = 1 if a01p_situa_`i'==1 & a01p_lientyp_`i'==2 & missing(mother_occup_status1y) replace mother_occup_status1y = 4 if a01p_situa_`i'==2 & a01p_lientyp_`i'==2 & missing(mother_occup_status1y) replace mother_occup_status1y = 2 if a01p_situa_`i'==3 & a01p_lientyp_`i'==2 & missing(mother_occup_status1y) replace mother_occup_status1y = 3 if inlist(a01p_situa_`i',4,5,6,7) & a01p_lientyp_`i'==2 & missing(mother_occup_status1y) } replace mother_occup_status1y = 1 if a01m_congmatpar_3==1 & missing(mother_occup_status1y) replace mother_occup_status1y = 3 if a01m_congmatpar_3==2 & missing(mother_occup_status1y) replace mother_occup_status1y = 1 if a01m_congmatpar_3==3 & missing(mother_occup_status1y) foreach i of numlist 3/10{ replace mother_occup_status1y = 1 if a01p_congmatpar_`i'==1 & a01p_lientyp_`i'==2 & missing(mother_occup_status1y) replace mother_occup_status1y = 3 if a01p_congmatpar_`i'==2 & a01p_lientyp_`i'==2 & missing(mother_occup_status1y) replace mother_occup_status1y = 1 if a01p_congmatpar_`i'==3 & a01p_lientyp_`i'==2 & missing(mother_occup_status1y) } label var mother_occup_status1y "Mother's occupational status, 1 year" label define mother_occup_status1y 1 "Employed" 2 "Unemployed" 3 "Other situation(housewife, retired, inactive)" 4 "Student, apprentice, intern" label values mother_occup_status1y mother_occup_status1y tab mother_occup_status1y, missing *3.7 Father's occupational status, 2 months g father_occup_status=. replace father_occup_status=4 if m02p_etudes_4==1 & m02p_lientyp_4==1 replace father_occup_status=4 if !missing(m02p_situae_4) & m02p_lientyp_4==1 & missing(father_occup_status) replace father_occup_status=1 if m02p_situa_4==1 & m02p_lientyp_4==1 & missing(father_occup_status) replace father_occup_status=4 if m02p_situa_4==2 & m02p_lientyp_4==1 & missing(father_occup_status) replace father_occup_status=2 if m02p_situa_4==3 & m02p_lientyp_4==1 & missing(father_occup_status) replace father_occup_status=3 if m02p_situa_4==4 & m02p_lientyp_4==1 & missing(father_occup_status) replace father_occup_status=3 if m02p_situa_4==5 & m02p_lientyp_4==1 & missing(father_occup_status) replace father_occup_status=3 if m02p_situa_4==6 & m02p_lientyp_4==1 & missing(father_occup_status) replace father_occup_status=3 if m02p_situa_4==7 & m02p_lientyp_4==1 & missing(father_occup_status) replace father_occup_status=4 if m02m_etudes_4==1 & missing(father_occup_status) & m02m_lientyp_4==1 replace father_occup_status=4 if !missing(m02m_situae_4) & m02p_lientyp_4==1 & missing(father_occup_status) replace father_occup_status=1 if m02m_situa_4==1 & missing(father_occup_status) & m02m_lientyp_4==1 replace father_occup_status=4 if m02m_situa_4==2 & missing(father_occup_status) & m02m_lientyp_4==1 replace father_occup_status=2 if m02m_situa_4==3 & missing(father_occup_status) & m02m_lientyp_4==1 replace father_occup_status=3 if m02m_situa_4==4 & missing(father_occup_status) & m02m_lientyp_4==1 replace father_occup_status=3 if m02m_situa_4==5 & missing(father_occup_status) & m02m_lientyp_4==1 replace father_occup_status=3 if m02m_situa_4==6 & missing(father_occup_status) & m02m_lientyp_4==1 replace father_occup_status=3 if m02m_situa_4==7 & missing(father_occup_status) & m02m_lientyp_4==1 replace father_occup_status=1 if m02p_congmatpar_4==1 & m02p_lientyp_4==1 & missing(father_occup_status) replace father_occup_status=3 if m02p_congmatpar_4==2 & m02p_lientyp_4==1 & missing(father_occup_status) replace father_occup_status=1 if m02p_congmatpar_4==3 & m02p_lientyp_4==1 & missing(father_occup_status) replace father_occup_status=1 if m02m_congmatpar_4==1 & m02m_lientyp_4==1 & missing(father_occup_status) replace father_occup_status=3 if m02m_congmatpar_4==2 & m02m_lientyp_4==1 & missing(father_occup_status) replace father_occup_status=1 if m02m_congmatpar_4==3 & m02m_lientyp_4==1 & missing(father_occup_status) replace father_occup_status=1 if m00m2_emploic==1 & missing(father_occup_status) replace father_occup_status=3 if m00m2_emploic==2 & missing(father_occup_status) replace father_occup_status=4 if m00m2_emploic==3 & missing(father_occup_status) replace father_occup_status=2 if m00m2_emploic==4 & missing(father_occup_status) replace father_occup_status=3 if m00m2_emploic==5 & missing(father_occup_status) replace father_occup_status=3 if m00m2_emploic==6 & missing(father_occup_status) replace father_occup_status=3 if m00m2_emploic==7 & missing(father_occup_status) label var father_occup_status "professional situation father, 2 months" label define father_occup_status 1 "employed" 2 "unemployed" 3 "other situation (incl. houseman, retired, handicapped pension, sick leave, paternity leave)" 4 "student, apprentice or intern" label values father_occup_status father_occup_status tab father_occup_status, missing *3.8. Father's occupational status, 1 year g father_occup_status1y = . foreach i of numlist 4/10{ replace father_occup_status1y = 4 if a01p_etudes_`i'==1 & a01p_lientyp_`i'==1 & missing(father_occup_status1y) replace father_occup_status1y = 4 if !missing(a01p_situae_`i') & a01p_lientyp_`i'==1 & missing(father_occup_status1y) replace father_occup_status1y = 1 if a01p_situa_`i'==1 & a01p_lientyp_`i'==1 & missing(father_occup_status1y) replace father_occup_status1y = 4 if a01p_situa_`i'==2 & a01p_lientyp_`i'==1 & missing(father_occup_status1y) replace father_occup_status1y = 2 if a01p_situa_`i'==3 & a01p_lientyp_`i'==1 & missing(father_occup_status1y) replace father_occup_status1y = 3 if inlist(a01p_situa_`i',4,5,6,7) & a01p_lientyp_`i'==1 & missing(father_occup_status1y) } foreach i of numlist 4/10{ replace father_occup_status1y = 4 if a01m_etudes_`i'==1 & a01m_lientyp_`i'==1 & missing(father_occup_status1y) replace father_occup_status1y = 4 if !missing(a01m_situae_`i') & a01m_lientyp_`i'==1 & missing(father_occup_status1y) replace father_occup_status1y = 1 if a01m_situa_`i'==1 & a01m_lientyp_`i'==1 & missing(father_occup_status1y) replace father_occup_status1y = 4 if a01m_situa_`i'==2 & a01m_lientyp_`i'==1 & missing(father_occup_status1y) replace father_occup_status1y = 2 if a01m_situa_`i'==3 & a01m_lientyp_`i'==1 & missing(father_occup_status1y) replace father_occup_status1y = 3 if inlist(a01m_situa_`i',4,5,6,7) & a01m_lientyp_`i'==1 & missing(father_occup_status1y) } foreach i of numlist 4/10{ replace father_occup_status1y = 1 if a01p_congmatpar_`i'==1 & a01p_lientyp_`i'==1 & missing(father_occup_status1y) replace father_occup_status1y = 3 if a01p_congmatpar_`i'==2 & a01p_lientyp_`i'==1 & missing(father_occup_status1y) replace father_occup_status1y = 1 if a01p_congmatpar_`i'==3 & a01p_lientyp_`i'==1 & missing(father_occup_status1y) } foreach i of numlist 4/10{ replace father_occup_status1y = 1 if a01m_congmatpar_`i'==1 & a01m_lientyp_`i'==1 & missing(father_occup_status1y) replace father_occup_status1y = 3 if a01m_congmatpar_`i'==2 & a01m_lientyp_`i'==1 & missing(father_occup_status1y) replace father_occup_status1y = 1 if a01m_congmatpar_`i'==3 & a01m_lientyp_`i'==1 & missing(father_occup_status1y) } label var father_occup_status1y "Father's occupational status, 1 year" label define father_occup_status1y 1 "Employed" 2 "Unemployed" 3 "Other situation(housewife, retired, inactive)" 4 "Student, apprentice, intern" label values father_occup_status1y father_occup_status1y tab father_occup_status1y, missing *3.7 Mother's partner occupational status, 2 months g mp_occup_2m=. replace mp_occup_2m=father_occup_status if m02m_lientyp_4==1 foreach i of numlist 4/6{ replace mp_occup_2m=4 if m02m_etudes_`i'==1 & m02m_lientyp_`i'==7 & missing(mp_occup_2m) replace mp_occup_2m=4 if !missing(m02m_situae_`i') & m02m_lientyp_`i'==7 & missing(mp_occup_2m) replace mp_occup_2m=1 if m02m_situa_`i'==1 & m02m_lientyp_`i'==7 & missing(mp_occup_2m) replace mp_occup_2m=4 if m02m_situa_`i'==2 & m02m_lientyp_`i'==7 & missing(mp_occup_2m) replace mp_occup_2m=2 if m02m_situa_`i'==3 & m02m_lientyp_`i'==7 & missing(mp_occup_2m) replace mp_occup_2m=3 if inlist(m02m_situa_`i',4,5,6,7) & m02m_lientyp_`i'==7 & missing(mp_occup_2m) replace mp_occup_2m=1 if m02m_congmatpar_`i'==1 & m02m_lientyp_`i'==7 & missing(mp_occup_2m) replace mp_occup_2m=3 if m02m_congmatpar_`i'==2 & m02m_lientyp_`i'==7 & missing(mp_occup_2m) replace mp_occup_2m=1 if m02m_congmatpar_`i'==3 & m02m_lientyp_`i'==7 & missing(mp_occup_2m) } label var mp_occup_2m "professional situation mother's partner (father or conjoint), 2 months" label define mp_occup_2m 1 "employed" 2 "unemployed" 3 "other situation (incl. houseman, retired, handicapped pension, sick leave, paternity leave)" 4 "student, apprentice or intern" label values mp_occup_2m mp_occup_2m tab mp_occup_2m, missing tab mp_occup_2m father_occup_status *3.7 Mother's partner occupational status, 1 year g mp_occup_1y=. foreach i of numlist 4/10{ replace mp_occup_1y=father_occup_status1y if a01m_lientyp_`i'==1 replace mp_occup_1y=4 if a01m_etudes_`i'==1 & a01m_lientyp_`i'==7 & missing(mp_occup_1y) replace mp_occup_1y=4 if !missing(a01m_situae_`i') & a01m_lientyp_`i'==7 & missing(mp_occup_1y) replace mp_occup_1y=1 if a01m_situa_`i'==1 & a01m_lientyp_`i'==7 & missing(mp_occup_1y) replace mp_occup_1y=4 if a01m_situa_`i'==2 & a01m_lientyp_`i'==7 & missing(mp_occup_1y) replace mp_occup_1y=2 if a01m_situa_`i'==3 & a01m_lientyp_`i'==7 & missing(mp_occup_1y) replace mp_occup_1y=3 if inlist(a01m_situa_`i',4,5,6,7) & a01m_lientyp_`i'==7 & missing(mp_occup_1y) replace mp_occup_1y=1 if a01m_congmatpar_`i'==1 & a01m_lientyp_`i'==7 & missing(mp_occup_1y) replace mp_occup_1y=3 if a01m_congmatpar_`i'==2 & a01m_lientyp_`i'==7 & missing(mp_occup_1y) replace mp_occup_1y=1 if a01m_congmatpar_`i'==3 & a01m_lientyp_`i'==7 & missing(mp_occup_1y) } label var mp_occup_1y "professional situation mother's partner (father or conjoint), 1 year" label define mp_occup_1y 1 "employed" 2 "unemployed" 3 "other situation (incl. houseman, retired, handicapped pension, sick leave, paternity leave)" 4 "student, apprentice or intern" label values mp_occup_1y mp_occup_1y tab mp_occup_1y, missing *3.7 Father's partner occupational status, 2 months g fp_occup_2m=. foreach i of numlist 3/10{ replace fp_occup_2m=mother_occup_status if m02p_lientyp_`i'==2 replace fp_occup_2m=4 if m02p_etudes_`i'==1 & m02p_lientyp_`i'==7 & missing(fp_occup_2m) replace fp_occup_2m=4 if !missing(m02p_situae_`i') & m02p_lientyp_`i'==7 & missing(fp_occup_2m) replace fp_occup_2m=1 if m02p_situa_`i'==1 & m02p_lientyp_`i'==7 & missing(fp_occup_2m) replace fp_occup_2m=4 if m02p_situa_`i'==2 & m02p_lientyp_`i'==7 & missing(fp_occup_2m) replace fp_occup_2m=2 if m02p_situa_`i'==3 & m02p_lientyp_`i'==7 & missing(fp_occup_2m) replace fp_occup_2m=3 if inlist(m02p_situa_`i',4,5,6,7) & m02p_lientyp_`i'==7 & missing(fp_occup_2m) replace fp_occup_2m=1 if m02p_congmatpar_`i'==1 & m02p_lientyp_`i'==7 & missing(fp_occup_2m) replace fp_occup_2m=3 if m02p_congmatpar_`i'==2 & m02p_lientyp_`i'==7 & missing(fp_occup_2m) replace fp_occup_2m=1 if m02p_congmatpar_`i'==3 & m02p_lientyp_`i'==7 & missing(fp_occup_2m) } label var fp_occup_2m "professional situation father's partner (mother or conjoint), 2 months" label define fp_occup_2m 1 "employed" 2 "unemployed" 3 "other situation (incl. houseman, retired, handicapped pension, sick leave, paternity leave)" 4 "student, apprentice or intern" label values fp_occup_2m fp_occup_2m tab fp_occup_2m, missing tab fp_occup_2m mother_occup_status *3.7 Father's partner occupational status, 1 year g fp_occup_1y=. foreach i of numlist 3/10{ replace fp_occup_1y=mother_occup_status1y if a01p_lientyp_`i'==2 replace fp_occup_1y=4 if a01p_etudes_`i'==1 & a01p_lientyp_`i'==7 & missing(fp_occup_1y) replace fp_occup_1y=4 if !missing(a01p_situae_`i') & a01p_lientyp_`i'==7 & missing(fp_occup_1y) replace fp_occup_1y=1 if a01p_situa_`i'==1 & a01p_lientyp_`i'==7 & missing(fp_occup_1y) replace fp_occup_1y=4 if a01p_situa_`i'==2 & a01p_lientyp_`i'==7 & missing(fp_occup_1y) replace fp_occup_1y=2 if a01p_situa_`i'==3 & a01p_lientyp_`i'==7 & missing(fp_occup_1y) replace fp_occup_1y=3 if inlist(a01p_situa_`i',4,5,6,7) & a01p_lientyp_`i'==7 & missing(fp_occup_1y) replace fp_occup_1y=1 if a01p_congmatpar_`i'==1 & a01p_lientyp_`i'==7 & missing(fp_occup_1y) replace fp_occup_1y=3 if a01p_congmatpar_`i'==2 & a01p_lientyp_`i'==7 & missing(fp_occup_1y) replace fp_occup_1y=1 if a01p_congmatpar_`i'==3 & a01p_lientyp_`i'==7 & missing(fp_occup_1y) } label var fp_occup_1y "professional situation father's partner (mother or conjoint), 1 year" label define fp_occup_1y 1 "employed" 2 "unemployed" 3 "other situation (incl. houseman, retired, handicapped pension, sick leave, paternity leave)" 4 "student, apprentice or intern" label values fp_occup_1y fp_occup_1y tab fp_occup_1y, missing tab fp_occup_1y mother_occup_status1y tab fp_occup_1y fp_occup_2m *** Parents employment status, 2 months g p_emp_2m = . replace p_emp_2m = 1 if inlist(mother_occup_status,2,3,4) | inlist(father_occup_status,2,3,4) replace p_emp_2m = 2 if inlist(mother_occup_status,2,3,4) & inlist(father_occup_status,2,3,4) replace p_emp_2m = 3 if mother_occup_status==1 & father_occup_status==1 replace p_emp_2m = 2 if inlist(mother_occup_status,2,3,4) & child_hhld==2 & missing(p_emp_2m) replace p_emp_2m = 3 if mother_occup_status==1 & child_hhld==2 & missing(p_emp_2m) replace p_emp_2m = 2 if inlist(father_occup_status,2,3,4) & child_hhld==3 & missing(p_emp_2m) replace p_emp_2m = 3 if father_occup_status==1 & child_hhld==3 & missing(p_emp_2m) label var p_emp_2m "Parents employment status, 2 months" label define p_emp_2m 1 "At least one parent not working" 2 "Both parents not working" 3 "Both parents working" label value p_emp_2m p_emp_2m tab p_emp_2m, missing *** Parents employment status , 1 year g p_emp_1y = . replace p_emp_1y = 1 if inlist(mother_occup_status1y,2,3,4) | inlist(father_occup_status1y,2,3,4) replace p_emp_1y = 2 if inlist(mother_occup_status1y,2,3,4) & inlist(father_occup_status1y,2,3,4) replace p_emp_1y = 3 if mother_occup_status1y==1 & father_occup_status1y==1 replace p_emp_1y = 2 if inlist(mother_occup_status1y,2,3,4) & child_hhld1y==2 & missing(p_emp_1y) replace p_emp_1y = 3 if mother_occup_status1y==1 & child_hhld1y==2 & missing(p_emp_1y) replace p_emp_1y = 2 if inlist(father_occup_status1y,2,3,4) & child_hhld1y==3 & missing(p_emp_1y) replace p_emp_1y = 3 if father_occup_status1y==1 & child_hhld1y==3 & missing(p_emp_1y) label var p_emp_1y "Parents employment status, 1 year" label define p_emp_1y 1 "At least one parent unemployed" 2 "Both parents unemployed" 3 "Both parents employed" 4 "Rest of situations" label value p_emp_1y p_emp_1y tab p_emp_1y, missing *** Household cohabiting couple employment status, 2 months g c_emp_2m = . replace c_emp_2m = 1 if (inlist(mother_occup_status,2,3,4) | inlist(father_occup_status,2,3,4)) & inlist(child_hhld,1,4,5,6) replace c_emp_2m = 2 if inlist(mother_occup_status,2,3,4) & inlist(father_occup_status,2,3,4) & inlist(child_hhld,1,4,5,6) replace c_emp_2m = 3 if mother_occup_status==1 & father_occup_status==1 & inlist(child_hhld,1,4,5,6) replace c_emp_2m = 2 if inlist(mother_occup_status,2,3,4) & inlist(mp_occup_2m,2,3,4) & inlist(child_hhld,2) & missing(c_emp_2m) replace c_emp_2m = 1 if (inlist(mother_occup_status,2,3,4) | inlist(mp_occup_2m,2,3,4)) & inlist(child_hhld,2) & missing(c_emp_2m) replace c_emp_2m = 3 if mother_occup_status==1 & mp_occup_2m==1 & inlist(child_hhld,2) & missing(c_emp_2m) replace c_emp_2m = 2 if inlist(fp_occup_2m,2,3,4) & inlist(father_occup_status,2,3,4) & inlist(child_hhld,3) & missing(c_emp_2m) replace c_emp_2m = 1 if (inlist(fp_occup_2m,2,3,4) | inlist(father_occup_status,2,3,4)) & inlist(child_hhld,3) & missing(c_emp_2m) replace c_emp_2m = 3 if fp_occup_2m==1 & father_occup_status==1 & inlist(child_hhld,3) & missing(c_emp_2m) label var c_emp_2m "Household cohabiting couple employment status, 2 months" label define c_emp_2m 1 "At least one person in the couple not working" 2 "Both not working" 3 "Both working" label value c_emp_2m c_emp_2m tab c_emp_2m, missing tab c_emp_2m p_emp_2m *** Household cohabiting couple employment status, 1 year g c_emp_1y = . replace c_emp_1y = 1 if (inlist(mother_occup_status1y,2,3,4) | inlist(father_occup_status1y,2,3,4)) & inlist(child_hhld1y,1,4,5,6) replace c_emp_1y = 2 if inlist(mother_occup_status1y,2,3,4) & inlist(father_occup_status1y,2,3,4) & inlist(child_hhld1y,1,4,5,6) replace c_emp_1y = 3 if mother_occup_status1y==1 & father_occup_status1y==1 & inlist(child_hhld1y,1,4,5,6) replace c_emp_1y = 2 if inlist(mother_occup_status1y,2,3,4) & inlist(mp_occup_1y,2,3,4) & inlist(child_hhld1y,2) & missing(c_emp_1y) replace c_emp_1y = 1 if (inlist(mother_occup_status1y,2,3,4) | inlist(mp_occup_1y,2,3,4)) & inlist(child_hhld1y,2) & missing(c_emp_1y) replace c_emp_1y = 3 if mother_occup_status1y==1 & mp_occup_1y==1 & inlist(child_hhld1y,2) & missing(c_emp_1y) replace c_emp_1y = 2 if inlist(fp_occup_1y,2,3,4) & inlist(father_occup_status1y,2,3,4) & inlist(child_hhld1y,3) & missing(c_emp_1y) replace c_emp_1y = 1 if (inlist(fp_occup_1y,2,3,4) | inlist(father_occup_status1y,2,3,4)) & inlist(child_hhld1y,3) & missing(c_emp_1y) replace c_emp_1y = 3 if fp_occup_1y==1 & father_occup_status1y==1 & inlist(child_hhld1y,3) & missing(c_emp_1y) label var c_emp_1y "Household cohabiting couple employment status, 1 year" label define c_emp_1y 1 "At least one person in the couple not working" 2 "Both not working" 3 "Both working" label value c_emp_1y c_emp_1y tab c_emp_1y, missing tab c_emp_1y c_emp_1y *3.9 Professional category of the mother, 2 months g professional_category=. replace professional_category=1 if m02m_statut1_3==1 & m02m_statut2_3==1 replace professional_category=2 if m02m_statut1_3==1 & m02m_statut2_3==2 replace professional_category=3 if m02m_statut1_3==2 replace professional_category=4 if m02m_statut1_3==3 foreach i of numlist 3/10{ replace professional_category=1 if m02p_statut1_`i'==1 & m02p_statut2_`i'==1 & m02p_lientyp_`i'==2 & professional_category==. replace professional_category=2 if m02p_statut1_`i'==1 & m02p_statut2_`i'==2 & m02p_lientyp_`i'==2 & professional_category==. replace professional_category=3 if m02p_statut1_`i'==2 & m02p_lientyp_`i'==2 & professional_category==. replace professional_category=4 if m02p_statut1_`i'==3 & m02p_lientyp_`i'==2 & professional_category==. } label var professional_category "professional category of the mother, 2 months" label define professional_category 1 "privately employed" /// 2 "publicly employed" /// 3 "self-employed" /// 4 "other" label values professional_category professional_category tab professional_category, missing *3.10 Professional category of the mother, 1 year g prof_cat_1y=. replace prof_cat_1y=1 if a01m_statut1_3==1 & a01m_statut2_3==1 replace prof_cat_1y=2 if a01m_statut1_3==1 & a01m_statut2_3==2 replace prof_cat_1y=3 if a01m_statut1_3==2 replace prof_cat_1y=4 if a01m_statut1_3==3 foreach i of numlist 3/10{ replace prof_cat_1y=1 if a01p_statut1_`i'==1 & a01p_statut2_`i'==1 & a01p_lientyp_`i'==2 & prof_cat_1y==. replace prof_cat_1y=2 if a01p_statut1_`i'==1 & a01p_statut2_`i'==2 & a01p_lientyp_`i'==2 & prof_cat_1y==. replace prof_cat_1y=3 if a01p_statut1_`i'==2 & a01p_lientyp_`i'==2 & prof_cat_1y==. replace prof_cat_1y=4 if a01p_statut1_`i'==3 & a01p_lientyp_`i'==2 & prof_cat_1y==. } label var prof_cat_1y "professional category of the mother, 1 year" label define prof_cat_1y 1 "privately employed" /// 2 "publicly employed" /// 3 "self-employed" /// 4 "other" label values prof_cat_1y professional_category tab prof_cat_1y, missing *3.11 Self-employment (mother), 2 months * we need professional_category g self_employed=. replace self_employed=1 if professional_category==3 replace self_employed=0 if inlist(professional_category, 1,2,4) label var self_employed "mother self-employed, 2 months" label define self_employed 0 "no" 1 "yes" label values self_employed self_employed tab self_employed, missing *3.12 Self-employment (mother), 1 year * we need prof_cat_1y g self_emp_1y=. replace self_emp_1y=1 if prof_cat_1y==3 replace self_emp_1y=0 if inlist(prof_cat_1y, 1,2,4) label var self_emp_1y "mother self-employed, 1 year" label define self_emp_1y 0 "no" 1 "yes" label values self_emp_1y self_emp_1y tab self_emp_1y, missing *3.13 Mother working part-time, 2 months g mother_work_parttime=. replace mother_work_parttime=1 if inlist(m02m_empl_3, 2) replace mother_work_parttime=0 if inlist(m02m_empl_3, 1) foreach i of numlist 3/10 { replace mother_work_parttime=1 if m02p_empl_`i'==2 & m02p_lientyp_`i'==2 & mother_work_parttime==. replace mother_work_parttime=0 if m02p_empl_`i'==1 & m02p_lientyp_`i'==2 & mother_work_parttime==. } label var mother_work_parttime "mother working parttime, 2 months" label define mother_work_parttime 0 "no" 1 "yes" label values mother_work_parttime mother_work_parttime tab mother_work_parttime, missing *3.14. Mother working part-time, 1 year g m_parttime_1y=. replace m_parttime_1y=1 if inlist(a01m_empl_3, 2) replace m_parttime_1y=0 if inlist(a01m_empl_3, 1) foreach i of numlist 3/10 { replace m_parttime_1y=1 if a01p_empl_`i'==2 & a01p_lientyp_`i'==2 & m_parttime_1y==. replace m_parttime_1y=0 if a01p_empl_`i'==1 & a01p_lientyp_`i'==2 & m_parttime_1y==. } label var m_parttime_1y "mother working parttime, 1 year" label define m_parttime_1y 0 "no" 1 "yes" label values m_parttime_1y m_parttime_1y tab m_parttime_1y, missing *3.15 Mother working at night, 2 months g mother_work_night=. replace mother_work_night =0 if m02m_wnuit==2 replace mother_work_night =1 if m02m_wnuit==1 label var mother_work_night "mother works at night, 2 months" label define mother_work_night 0 "no" 1 "yes" label values mother_work_night mother_work_night tab mother_work_night, missing *3.16 Mother fixed workplace during the pregnancy g fixed_workplace_preg=. replace fixed_workplace_preg=0 if m02m_rfix==2 replace fixed_workplace_preg=1 if m02m_rfix==1 label var fixed_workplace_preg "fixed workplace during pregnancy" label define fixed_workplace_preg 0 "no" 1 "yes" label values fixed_workplace_preg fixed_workplace_preg tab fixed_workplace_preg, missing *3.17 Mother working at home during the pregnancy g work_home_preg=. replace work_home_preg=0 if m02m_trgrdom==2 replace work_home_preg=1 if m02m_trgrdom==1 replace work_home_preg=0 if m02m_rfix==2 & work_home_preg==. label var work_home_preg "working from home during the pregnancy" label define work_home_preg 0 "no" 1 "yes" label values work_home_preg work_home_preg tab work_home_preg, missing *3.18 Mother professional outlook g professional_outlook_mother=. replace professional_outlook_mother=1 if inlist(m02m_situ, 1, 2, 3) replace professional_outlook_mother=2 if inlist(m02m_situ, 4, 6) replace professional_outlook_mother=3 if inlist(m02m_situ, 5, 7, 8) label var professional_outlook_mother "Mother's professional aim at short term, 2 months" label define professional_outlook_mother 1 "working" 2 "unemployed" 3 "inactive" label values professional_outlook_mother professional_outlook_mother tab professional_outlook_mother, missing *3.19 Income per household member, 2 months replace m02m_datinta = 2011 if m02m_vague < 3 replace m02m_datinta = 2012 if m02m_vague == 4 replace m02m_datinta = (2011+int((2012-2011+1)*runiform())) if missing(m02m_datinta) & m02m_vague == 3 //randomly assigned 2011,2012 if wave 3 foreach i of numlist 3/12{ replace m02m_anais_`i' = . if m02m_anais_`i' == 9999 | m02m_anais_`i' == 8888 g parts_`i' = .5 *(m02m_datinta - m02m_anais_`i'>= 14) + .3 *(m02m_datinta - m02m_anais_`i'< 14) if !missing(m02m_anais_`i') replace parts_`i' = 0 if missing(m02m_anais_`i') } g parts_tot = 0.5 + 0.3 + (m00m2_nais == 1)*.3 + parts_3 + parts_4 + parts_5 + parts_6 + parts_7 + parts_8 + parts_9 + parts_10 + parts_11 + parts_12 replace parts_tot = . if parts_tot<1.2 //minumum value is one adult + the baby 1.3. missing values are wrongly generated with the parts_tot statement. then we correct foreach v1 in m02m_salmon m02m_salmonc m02p_salmon m02p_salmonc m02p_totreven m02m_totreven { //corrections recode `v1' (99999=.) (88888=.) } foreach v1 in m02p_salmonp m02m_salmonp m02p_salmoncp m02m_salmoncp { recode `v1' (9=.) (8=.) } replace m02m_salmon = (m02m_salmon/12) if m02m_salmonp==2 //making it monthly replace m02m_salmonc = (m02m_salmonc/12) if m02m_salmoncp==2 replace m02p_salmon = (m02p_salmon/12) if m02p_salmonp==2 replace m02p_salmonc = (m02p_salmonc/12) if m02p_salmoncp==2 g revenu = m02m_totreven foreach i of numlist 3/10{ replace revenu = m02p_totreven if missing(revenu) & m02p_lientyp_`i'==2 } replace revenu = (m02m_salmon+m02m_salmonc) if missing(revenu) foreach i of numlist 3/10{ replace revenu = (m02p_salmon+m02p_salmonc) if missing(revenu) & m02p_lientyp_`i'==2 } replace revenu = m02m_salmon if m02m_salmonc==. & m02p_salmon==. & m02p_salmonc==. & revenu==. //if only the mother works and it is the only info replace revenu = m02m_salmonc if m02m_salmon==. & m02p_salmon==. & m02p_salmonc==. & revenu==. //if only the mother' partner works and it is the only info foreach i of numlist 3/10{ replace revenu = m02p_salmon if m02p_salmonc==. & m02m_salmon==. & m02m_salmonc==. & revenu==. & m02p_lientyp_`i'==2 //if only the father works, he lives in couple with the mother and it is the only info replace revenu = m02p_salmon if m02p_salmonc==. & m02m_salmon==. & m02m_salmonc==. & revenu==. & m02p_lientyp_`i'==2 //if only the father's partner (mother) works and it is the only info } replace m02m_loyer = . if inlist(m02m_loyer,9999,99999) replace m02p_loyer = . if inlist(m02p_loyer,9999,99999) replace m02m_imom = . if inlist(m02m_imom,9999,99999) replace m02p_imom = . if inlist(m02p_imom,9999,99999) replace m02m_imoan = . if inlist(m02m_imoan,9999,99999) replace m02p_imoan = . if inlist(m02p_imoan,9999,99999) g hcosts = m02m_loyer foreach i of numlist 3/10{ replace hcosts = m02p_loyer if missing(hcosts) & m02p_lientyp_`i'==2 } replace m02m_imom = m02m_imoan/12 if missing(m02m_imom) replace m02p_imom = m02p_imoan/12 if missing(m02p_imom) replace hcosts = m02m_imom if missing(hcosts) foreach i of numlist 3/10{ replace hcosts = m02p_imom if missing(hcosts) & m02p_lientyp_`i'==2 } replace hcosts = 0 if m02m_stoc==3 & missing(hcosts) foreach i of numlist 3/10{ replace hcosts = 0 if m02p_stoc==3 & missing(hcosts) & m02p_lientyp_`i'==2 } replace hcosts = . if hcosts>2000 & hcosts>revenu g disinc = revenu - hcosts g disinc_part = disinc/parts_tot label var disinc_part "disposable income per household member, 2 months" sum disinc_part g rev_part = revenu / parts_tot label var rev_part "income per household member, 2 months" sum rev_part xtile disinc_part_q = disinc_part, nq(5) // check if well done with: pctile var1 = disinc_part, nq(5) label var disinc_part_q "Quantiles of disposable income per hhld member, 2 months" label define disinc_part_q 1 "Q1" 2 "Q2" 3 "Q3" 4 "Q4" 5 "Q5" label value disinc_part_q disinc_part_q tabstat disinc_part, statistics(mean count) by(disinc_part_q) xtile disinc_part_d = disinc_part, nq(10) // check if well done with: pctile var2 = disinc_part, nq(10) label var disinc_part_d "Deciles of disposable income per hhld member, 2 months" label define disinc_part_d 1 "D1" 2 "D2" 3 "D3" 4 "D4" 5 "D5" 6 "D6" 7 "D7" 8 "D8" 9 "D9" 10 "D10" label value disinc_part_d disinc_part_d tabstat disinc_part, statistics(mean count) by(disinc_part_d) *3.20. Income per household member, 1 year replace m02m_datinta = 2011 if m02m_vague < 3 replace m02m_datinta = 2012 if m02m_vague == 4 replace m02m_datinta = (2011+int((2012-2011+1)*runiform())) if missing(m02m_datinta) & m02m_vague == 3 //randomly assigned 2011,2012 if wave 3 foreach i of numlist 3/10{ replace a01m_anais_`i' = . if a01m_anais_`i' == 9999 | a01m_anais_`i' == 8888 g parts_`i'_1y = .5 *(m02m_datinta - a01m_anais_`i'>= 14) + .3 *(m02m_datinta - a01m_anais_`i'< 14) if !missing(a01m_anais_`i') replace parts_`i'_1y = 0 if missing(a01m_anais_`i') } g parts_tot1y = 0.5 + 0.3 + (m00m2_nais == 1)*.3 + parts_3_1y + parts_4_1y + parts_5_1y + parts_6_1y + parts_7_1y + parts_8_1y + parts_9_1y + parts_10_1y replace parts_tot1y = . if parts_tot1y<1.2 //minumum value is one adult + the baby 1.3. missing values are wrongly generated with the parts_tot statement. then we correct foreach v1 in a01m_salmon a01m_salmonc a01p_salmon a01p_salmonc a01p_totreven a01m_totreven { //corrections recode `v1' (99999=.) (88888=.) } foreach v1 in a01p_salmonp a01m_salmonp a01p_salmoncp a01m_salmoncp{ recode `v1' (9=.) (8=.) } replace a01m_salmon = (a01m_salmon/12) if a01m_salmonp==2 //making it monthly replace a01m_salmonc = (a01m_salmonc/12) if a01m_salmoncp==2 replace a01p_salmon = (a01p_salmon/12) if a01p_salmonp==2 replace a01p_salmonc = (a01p_salmonc/12) if a01p_salmoncp==2 g revenu1y = a01m_totreven foreach i of numlist 3/10{ replace revenu1y = a01p_totreven if missing(revenu1y) & a01p_lientyp_`i'==2 } replace revenu1y = (a01m_salmon+a01m_salmonc) if missing(revenu1y) foreach i of numlist 3/10{ replace revenu1y = (a01p_salmon+a01p_salmonc) if missing(revenu1y) & a01p_lientyp_`i'==2 } replace revenu1y = a01m_salmon if a01m_salmonc==. & a01p_salmon==. & a01p_salmonc==. & revenu1y==. //if only the mother works and it is the only info replace revenu1y = a01m_salmonc if a01m_salmon==. & a01p_salmon==. & a01p_salmonc==. & revenu1y==. //if only the mother' partner works and it is the only info foreach i of numlist 3/10{ replace revenu1y = a01p_salmon if a01p_salmonc==. & a01m_salmon==. & a01m_salmonc==. & revenu1y==. & a01p_lientyp_`i'==2 //if only the father works, he lives in couple with the mother and it is the only info replace revenu1y = a01p_salmon if a01p_salmonc==. & a01m_salmon==. & a01m_salmonc==. & revenu1y==. & a01p_lientyp_`i'==2 //if only the father's partner (mother) works and it is the only info } replace a01m_loyer = . if inlist(a01m_loyer,9999,99999) replace a01p_loyer = . if inlist(a01p_loyer,9999,99999) replace a01m_qempr = . if inlist(a01m_qempr,9999,99999) replace a01p_qempr = . if inlist(a01p_qempr,9999,99999) g hcosts1 = a01m_loyer foreach i of numlist 3/10{ replace hcosts1 = a01p_loyer if missing(hcosts1) & a01p_lientyp_`i'==2 } replace hcosts1 = 0 if a01m_empr==2 & missing(hcosts1) foreach i of numlist 3/10{ replace hcosts1 = 0 if a01p_empr==2 & missing(hcosts1) & a01p_lientyp_`i'==2 } replace hcosts1 = a01m_qempr if missing(hcosts1) foreach i of numlist 3/10{ replace hcosts1 = a01p_qempr if missing(hcosts1) & a01p_lientyp_`i'==2 } replace hcosts1 = 0 if inlist(a01m_stoc,3,4,5,6) & missing(hcosts1) foreach i of numlist 3/10{ replace hcosts1 = 0 if inlist(a01p_stoc,3,4,5,6) & missing(hcosts1) & a01p_lientyp_`i'==2 } replace hcosts1 = hcosts if demenag==0 & missing(hcosts1) replace hcosts1 = . if hcosts1>2000 & hcosts1>revenu1y sum hcosts1 g disinc1 = revenu1y - hcosts1 g disinc_part1 = disinc1/parts_tot1y label var disinc_part1 "disposable income per household member, 1 year" sum disinc_part1 g rev_part1 = revenu1y/parts_tot1y label var rev_part1 "Income per household member, 1 year" sum rev_part1 xtile disinc_part1_q = disinc_part1, nq(5) // check if well done with: pctile var3 = disinc_part1, nq(5) label var disinc_part1_q "Quantiles of disposable income per hhld member, 1 year" label define disinc_part1_q 1 "Q1" 2 "Q2" 3 "Q3" 4 "Q4" 5 "Q5" label value disinc_part1_q disinc_part1_q tabstat disinc_part1, statistics(mean count) by(disinc_part1_q) xtile disinc_part1_d = disinc_part1, nq(10) // check if well done with: pctile var4 = disinc_part1, nq(10) label var disinc_part1_d "Deciles of disposable income per hhld member, 1 year" label define disinc_part1_d 1 "D1" 2 "D2" 3 "D3" 4 "D4" 5 "D5" 6 "D6" 7 "D7" 8 "D8" 9 "D9" 10 "D10" label value disinc_part1_d disinc_part1_d tabstat disinc_part1, statistics(mean count) by(disinc_part1_d) *3.21 Difficulty making ends meet, 2 months g diff_making_ends=. replace diff_making_ends=0 if inlist(m02m_actfi, 1, 2, 3) replace diff_making_ends=1 if inlist(m02m_actfi, 4, 5) foreach i of numlist 3/10{ replace diff_making_ends=0 if inlist(m02p_actfi, 1, 2, 3) & missing(diff_making_ends) & m02p_lientyp_`i'==2 replace diff_making_ends=1 if inlist(m02p_actfi, 4, 5) & missing(diff_making_ends) & m02p_lientyp_`i'==2 } label var diff_making_ends "difficulty making ends meet, 2 months" label define diff_making_ends 0 "no difficulty" 1 "difficulty" label values diff_making_ends diff_making_ends tab diff_making_ends, missing *3.22 Unemployment benefit, 2 months g unemployment_benefit=. replace unemployment_benefit=1 if m02m_rcho==1 replace unemployment_benefit=0 if m02m_rcho==2 foreach i of numlist 3/10{ replace unemployment_benefit=1 if m02p_rcho==1 & missing(unemployment_benefit) & m02p_lientyp_`i'==2 replace unemployment_benefit=0 if m02p_rcho==2 & missing(unemployment_benefit) & m02p_lientyp_`i'==2 } label var unemployment_benefit "unemployment benefit, 2 months" label define unemployment_benefit 0"no" 1 "yes" label values unemployment_benefit unemployment_benefit tab unemployment_benefit, missing *3.23 unemployment benefit, 1 year g unemployment_benefit1y=. replace unemployment_benefit1y=1 if a01m_rcho==1 replace unemployment_benefit1y=0 if a01m_rcho==2 foreach i of numlist 3/10{ replace unemployment_benefit1y=1 if a01p_rcho==1 & missing(unemployment_benefit1y) & a01p_lientyp_`i'==2 replace unemployment_benefit1y=0 if a01p_rcho==2 & missing(unemployment_benefit1y) & a01p_lientyp_`i'==2 } label var unemployment_benefit1y "unemployment benefit, 1 year" label define unemployment_benefit1y 0"no" 1 "yes" label values unemployment_benefit1y unemployment_benefit1y tab unemployment_benefit1y, missing *3.24 Active solidarity Benefit, 2 months g active_solidarity_benefit=. replace active_solidarity_benefit=1 if m02m_rrsa==1 replace active_solidarity_benefit=0 if m02m_rrsa==2 foreach i of numlist 3/10{ replace active_solidarity_benefit=1 if m02p_rrsa==1 & active_solidarity_benefit==. & m02p_lientyp_`i'==2 replace active_solidarity_benefit=0 if m02p_rrsa==2 & active_solidarity_benefit==. & m02p_lientyp_`i'==2 } label var active_solidarity_benefit "active solidarity benefit, 2 months" label define active_solidarity_benefit 0"no" 1 "yes" label values active_solidarity_benefit active_solidarity_benefit tab active_solidarity_benefit, missing *3.25 active solidarity benefit, 1 year g active_solidarity_benefit1y=. replace active_solidarity_benefit1y=1 if a01m_rrsa==1 replace active_solidarity_benefit1y=0 if a01m_rrsa==2 foreach i of numlist 3/10{ replace active_solidarity_benefit1y=1 if a01p_rrsa==1 & active_solidarity_benefit1y==. & a01p_lientyp_`i'==2 replace active_solidarity_benefit1y=0 if a01p_rrsa==2 & active_solidarity_benefit1y==. & a01p_lientyp_`i'==2 } label var active_solidarity_benefit1y "active solidarity benefit, 1 year" label define active_solidarity_benefit1y 0"no" 1 "yes" label values active_solidarity_benefit1y active_solidarity_benefit1y tab active_solidarity_benefit1y, missing *3.26 Housing benefits, 2 months g housing_benefit=. replace housing_benefit=1 if m02m_rlog==1 replace housing_benefit=0 if m02m_rlog==2 foreach i of numlist 3/10{ replace housing_benefit=1 if m02p_rlog==1 & housing_benefit==. & m02p_lientyp_`i'==2 replace housing_benefit=0 if m02p_rlog==2 & housing_benefit==. & m02p_lientyp_`i'==2 } label var housing_benefit "housing benefit, 2 months" label define housing_benefit 0"no" 1 "yes" label values housing_benefit housing_benefit tab housing_benefit, missing *3.27 housing benefits, 1 year g housing_benefit1y=. replace housing_benefit1y=1 if a01m_rlog==1 replace housing_benefit1y=0 if a01m_rlog==2 foreach i of numlist 3/10{ replace housing_benefit1y=1 if a01p_rlog==1 & housing_benefit1y==. & a01p_lientyp_`i'==2 replace housing_benefit1y=0 if a01p_rlog==2 & housing_benefit1y==. & a01p_lientyp_`i'==2 } label var housing_benefit1y "housing benefit, 1 year" label define housing_benefit1y 0"no" 1 "yes" label values housing_benefit1y housing_benefit1y tab housing_benefit1y, missing *3.28 Social Welfare dependency, 2 months * we need unemployment_benefit, housing_benefit and active_solidarity_benefit g social_welfare_dependency=. replace social_welfare_dependency=1 if unemployment_benefit==1 | housing_benefit==1 | active_solidarity_benefit==1 replace social_welfare_dependency=0 if unemployment_benefit==0 & housing_benefit==0 & active_solidarity_benefit==0 label var social_welfare_dependency "social welfare dependency, 2 months" label define social_welfare_dependency 0"no" 1 "yes" label values social_welfare_dependency social_welfare_dependency tab social_welfare_dependency, missing *3.29 social welfare dependency, 1 year *we need unemployment_benefit1y, housing_benefit1y and active_solidarity_benefit1y g social_welfare_dependency1y=. replace social_welfare_dependency1y=1 if unemployment_benefit1y==1 | housing_benefit1y==1 | active_solidarity_benefit1y==1 replace social_welfare_dependency1y=0 if unemployment_benefit1y==0 & housing_benefit1y==0 & active_solidarity_benefit1y==0 label var social_welfare_dependency1y "social welfare dependency, 1 year" label define social_welfare_dependency1y 0"no" 1 "yes" label values social_welfare_dependency1y social_welfare_dependency1y tab social_welfare_dependency1y, missing *3.30 Housing type, 2 months g house_type=. replace house_type=1 if m02m_typlog==1 replace house_type=2 if m02m_typlog==2 replace house_type=3 if inlist(m02m_typlog, 3, 4, 5, 6, 7, 8) foreach i of numlist 3/10{ replace house_type=1 if m02p_typlog==1 & house_type==. & m02p_lientyp_`i'==2 replace house_type=2 if m02p_typlog==2 & house_type==. & m02p_lientyp_`i'==2 replace house_type=3 if inlist(m02p_typlog, 3, 4, 5, 6, 7, 8) & house_type==. & m02p_lientyp_`i'==2 } lab var house_type "type of house where the child lives, 2 months" label define house_type 1 "house" 2 "apartment" 3 "other" label values house_type house_type tab house_type, missing *3.31 housing type, 1 year g house_type1y=. replace house_type1y=1 if a01m_typlog==1 replace house_type1y=2 if a01m_typlog==2 replace house_type1y=3 if inlist(a01m_typlog, 3, 4, 5, 6, 7, 8) foreach i of numlist 3/10{ replace house_type1y=1 if a01p_typlog==1 & house_type==. & a01p_lientyp_`i'==2 replace house_type1y=2 if a01p_typlog==2 & house_type==. & a01p_lientyp_`i'==2 replace house_type1y=3 if inlist(a01p_typlog, 3, 4, 5, 6, 7, 8) & house_type==. & a01p_lientyp_`i'==2 } lab var house_type1y "type of house where the child lives, 1 year" label define house_type1y 1 "house" 2 "apartment" 3 "other" label values house_type1y house_type1y tab house_type1y, missing *3.32 House ownership, 2 months g house_ownership=. replace house_ownership=1 if inlist(m02m_stoc, 2, 3) replace house_ownership=2 if inlist(m02m_stoc, 1) replace house_ownership=5 if inlist(m02m_stoc, 4, 5, 6) replace house_ownership=4 if m02m_stoc==5 & m02m_propfam==1 replace house_ownership=3 if inlist(m02m_stoc,1,5) & m02m_prophlm==1 foreach i of numlist 3/10{ replace house_ownership=1 if inlist(m02p_stoc, 2, 3) & house_ownership==. & m02p_lientyp_`i'==2 replace house_ownership=3 if inlist(m02p_stoc,1,5) & m02p_prophlm==1 & house_ownership==. & m02p_lientyp_`i'==2 replace house_ownership=2 if inlist(m02p_stoc, 1) & house_ownership==. & m02p_lientyp_`i'==2 replace house_ownership=4 if m02p_stoc==5 & m02p_propfam==1 & house_ownership==. & m02p_lientyp_`i'==2 replace house_ownership=5 if inlist(m02p_stoc, 4, 5, 6) & house_ownership==. & m02p_lientyp_`i'==2 } replace house_ownership=5 if inlist(m02m_typlog, 3, 4, 5, 6, 7, 8) & house_ownership==. foreach i of numlist 3/10{ replace house_ownership=5 if inlist(m02p_typlog, 3, 4, 5, 6, 7, 8) & house_ownership==. & m02p_lientyp_`i'==2 } lab var house_ownership "housing ownership status, 2 months" label define house_ownership 1 "owned" 2 "rented" 3 "publicly subsidised" 4 "family member" 5 "other" label values house_ownership house_ownership tab house_ownership, missing *3.33 house ownership, 1 year g house_ownership1y=. replace house_ownership1y=1 if inlist(a01m_stoc, 2, 3) replace house_ownership1y=2 if inlist(a01m_stoc, 1) replace house_ownership1y=5 if inlist(a01m_stoc, 4, 5, 6) replace house_ownership1y=4 if a01m_stoc==5 & a01m_propfam==1 replace house_ownership1y=3 if inlist(a01m_stoc,1,5) & a01m_prophlm==1 foreach i of numlist 3/10{ replace house_ownership1y=1 if inlist(a01p_stoc, 2, 3) & house_ownership1y==. & a01p_lientyp_`i'==2 replace house_ownership1y=3 if inlist(a01p_stoc,1,5) & a01p_prophlm==1 & house_ownership1y==. & a01p_lientyp_`i'==2 replace house_ownership1y=2 if inlist(a01p_stoc, 1) & house_ownership1y==. & a01p_lientyp_`i'==2 replace house_ownership1y=4 if a01p_stoc==5 & a01p_propfam==1 & house_ownership1y==. & a01p_lientyp_`i'==2 replace house_ownership1y=5 if inlist(a01p_stoc, 4, 5, 6) & house_ownership1y==. & a01p_lientyp_`i'==2 } replace house_ownership1y=5 if inlist(a01m_typlog, 3, 4, 5, 6, 7, 8) & house_ownership1y==. foreach i of numlist 3/10{ replace house_ownership1y=5 if inlist(a01p_typlog, 3, 4, 5, 6, 7, 8) & house_ownership1y==. & a01p_lientyp_`i'==2 } lab var house_ownership1y "housing ownership status, 1 year" label define house_ownership1y 1 "owned" 2 "rented" 3 "publicly subsidised" 4 "family member" 5 "other" label values house_ownership1y house_ownership1y tab house_ownership1y, missing *******************************4. MIGRATION************************************ *4.1. Mother born in France g mbirthfr = 1 if m02m_lnais_3==1 //born in france replace mbirthfr = 0 if m02m_lnais_3==2 //born abroad replace mbirthfr = 1 if a01m_lnais_3==1 //born in france replace mbirthfr = 0 if a01m_lnais_3==2 //born abroad foreach i of numlist 5/10{ replace mbirthfr = 1 if m02p_lnais_`i'==1 & m02p_lientyp_`i'==2 & missing(mbirthfr) replace mbirthfr = 0 if m02p_lnais_`i'==2 & m02p_lientyp_`i'==2 & missing(mbirthfr) } foreach i of numlist 3/10{ replace mbirthfr = 1 if a01p_lnais_`i'==1 & a01p_lientyp_`i'==2 & missing(mbirthfr) replace mbirthfr = 0 if a01p_lnais_`i'==2 & a01p_lientyp_`i'==2 & missing(mbirthfr) } replace mbirthfr = 1 if m00m2_lieunaism==1 & missing(mbirthfr) replace mbirthfr = 0 if m00m2_lieunaism==2 & missing(mbirthfr) label var mbirthfr "mother born in france" label define mbirthfr 1 "yes" 0 "no" label values mbirthfr mbirthfr tab mbirthfr, missing *4.2. Mother french nationality at birth g mnationfr = 1 if m02m_natio1n_3==1 //born with french nationality replace mnationfr = 0 if inlist(m02m_natio1n_3,2,3,4) //not born with french nationality replace mnationfr = 1 if a01m_natio1n_3==1 //born with french nationality replace mnationfr = 0 if inlist(a01m_natio1n_3,2,3,4) //not born with french nationality foreach i of numlist 5/10{ replace mnationfr = 1 if m02p_natio1n_`i'==1 & m02p_lientyp_`i'==2 & missing(mnationfr) replace mnationfr = 0 if inlist(m02p_natio1n_`i',2,3,4) & m02p_lientyp_`i'==2 & missing(mnationfr) } foreach i of numlist 3/10{ replace mnationfr = 1 if a01p_natio1n_`i'==1 & a01p_lientyp_`i'==2 & missing(mnationfr) replace mnationfr = 0 if inlist(a01p_natio1n_`i',2,3,4) & a01p_lientyp_`i'==2 & missing(mnationfr) } replace mnationfr = 1 if m00m2_natiom==1 & missing(mnationfr) replace mnationfr = 0 if inlist(m00m2_natiom,2,3,4) & missing(mnationfr) label var mnationfr "mother french nationality at birth" label define mnationfr 1 "yes" 0 "no" label values mnationfr mnationfr tab mnationfr, missing *4.3. Father born in France g fbirthfr = 1 if m02p_lnais_4==1 & m02p_lientyp_4==1 replace fbirthfr = 0 if m02p_lnais_4==2 & m02p_lientyp_4==1 foreach i of numlist 4/10{ replace fbirthfr = 1 if a01p_lnais_`i'==1 & a01p_lientyp_`i'==1 replace fbirthfr = 0 if a01p_lnais_`i'==2 & a01p_lientyp_`i'==1 } replace fbirthfr = 1 if m02m_lnais_4==1 & m02m_lientyp_4==1 & missing(fbirthfr) replace fbirthfr = 0 if m02m_lnais_4==2 & m02m_lientyp_4==1 & missing(fbirthfr) foreach i of numlist 4/10{ replace fbirthfr = 1 if a01m_lnais_`i'==1 & a01m_lientyp_`i'==1 & missing(fbirthfr) replace fbirthfr = 0 if a01m_lnais_`i'==2 & a01m_lientyp_`i'==1 & missing(fbirthfr) } replace fbirthfr = 1 if m00m2_lieunaisp==1 & missing(fbirthfr) replace fbirthfr = 0 if m00m2_lieunaisp==2 & missing(fbirthfr) label var fbirthfr "father born in france" label define fbirthfr 1 "yes" 0 "no" label values fbirthfr fbirthfr tab fbirthfr, missing *4.5. Father french nationality at birth g fnationfr = 1 if m02p_natio1n_4==1 & m02p_lientyp_4==1 //born french nationality replace fnationfr = 0 if inlist(m02p_natio1n_4,2,3,4) & m02p_lientyp_4==1 foreach i of numlist 4/10{ replace fnationfr = 1 if a01p_natio1n_`i'==1 & a01p_lientyp_`i'==1 //born french nationality replace fnationfr = 0 if inlist(a01p_natio1n_`i',2,3,4) & a01p_lientyp_`i'==1 } replace fnationfr = 1 if m02m_natio1n_4==1 & m02m_lientyp_4==1 & missing(fnationfr) replace fnationfr = 0 if inlist(m02m_natio1n_4,2,3,4) & m02m_lientyp_4==1 & missing(fnationfr) foreach i of numlist 4/10{ replace fnationfr = 1 if a01m_natio1n_`i'==1 & a01m_lientyp_`i'==1 & missing(fnationfr) replace fnationfr = 0 if inlist(a01m_natio1n_`i',2,3,4) & a01m_lientyp_`i'==1 & missing(fnationfr) } replace fnationfr = 1 if m00m2_natiop==1 & missing(fnationfr) replace fnationfr = 0 if inlist(m00m2_natiop,2,3) & missing(fnationfr) label var fnationfr "father french nationality at birth" label define fnationfr 1 "yes" 0 "no" label values fnationfr fnationfr tab fnationfr, missing *4.6. Grandmother born in France (mother) g m_gmbirthfr = 1 if m02m_mblieu==1 replace m_gmbirthfr = 0 if m02m_mblieu==2 foreach i of numlist 4/10{ replace m_gmbirthfr = 1 if m02m_lnais_`i'==1 & m02m_lientyp_`i'==8 & m02m_sexec1_`i'==2 & missing(m_gmbirthfr) //grandparent (mother), female, born in france replace m_gmbirthfr = 0 if m02m_lnais_`i'==2 & m02m_lientyp_`i'==8 & m02m_sexec1_`i'==2 & missing(m_gmbirthfr) } foreach i of numlist 4/10{ replace m_gmbirthfr = 1 if a01m_lnais_`i'==1 & a01m_lientyp_`i'==8 & a01m_sexe_`i'==2 & missing(m_gmbirthfr) //grandparent (mother), female, born in france replace m_gmbirthfr = 0 if a01m_lnais_`i'==2 & a01m_lientyp_`i'==8 & a01m_sexe_`i'==2 & missing(m_gmbirthfr) } replace m_gmbirthfr = 1 if m02p_bmlieu==1 & missing(m_gmbirthfr) replace m_gmbirthfr = 0 if m02p_bmlieu==2 & missing(m_gmbirthfr) foreach i of numlist 5/9{ replace m_gmbirthfr = 1 if m02p_lnais_`i'==1 & m02p_lientyp_`i'==8 & m02p_sexec1_`i'==2 & missing(m_gmbirthfr) //grandparent (mother), female, born in france replace m_gmbirthfr = 0 if m02p_lnais_`i'==2 & m02p_lientyp_`i'==8 & m02p_sexec1_`i'==2 & missing(m_gmbirthfr) } foreach i of numlist 4/9{ replace m_gmbirthfr = 1 if a01p_lnais_`i'==1 & a01p_lientyp_`i'==8 & a01p_sexe_`i'==2 & missing(m_gmbirthfr) //grandparent (mother), female, born in france replace m_gmbirthfr = 0 if a01p_lnais_`i'==2 & a01p_lientyp_`i'==8 & a01p_sexe_`i'==2 & missing(m_gmbirthfr) } label var m_gmbirthfr "grandmother born in france (mother)" label define m_gmbirthfr 1 "yes" 0 "no" label values m_gmbirthfr m_gmbirthfr tab m_gmbirthfr, missing *4.7. Grandmother french nationality at birth (mother) g m_gmnationfr = 1 if m02m_mbfranc==1 replace m_gmnationfr = 0 if inlist(m02m_mbfranc,2,3,4) foreach i of numlist 4/10{ replace m_gmnationfr = 1 if m02m_natio1n_`i'==1 & m02m_lientyp_`i'==8 & m02m_sexec1_`i'==2 & missing(m_gmnationfr) //grandparent (mother), female french nationality at birth replace m_gmnationfr = 0 if inlist(m02m_natio1n_`i',2,3,4) & m02m_lientyp_`i'==8 & m02m_sexec1_`i'==2 & missing(m_gmnationfr) } foreach i of numlist 4/10{ replace m_gmnationfr = 1 if a01m_natio1n_`i'==1 & a01m_lientyp_`i'==8 & a01m_sexe_`i'==2 & missing(m_gmnationfr) //grandparent (mother), female french nationality at birth replace m_gmnationfr = 0 if inlist(a01m_natio1n_`i',2,3,4) & a01m_lientyp_`i'==8 & a01m_sexe_`i'==2 & missing(m_gmnationfr) } replace m_gmnationfr = 1 if m02p_bmfranc==1 & missing(m_gmnationfr) replace m_gmnationfr = 0 if inlist(m02p_bmfranc,2,3,4) & missing(m_gmnationfr) foreach i of numlist 5/9{ replace m_gmnationfr = 1 if m02p_natio1n_`i'==1 & m02p_lientyp_`i'==8 & m02p_sexec1_`i'==2 & missing(m_gmnationfr) //grandparent (mother), female french nationality at birth replace m_gmnationfr = 0 if inlist(m02p_natio1n_`i',2,3,4) & m02p_lientyp_`i'==8 & m02p_sexec1_`i'==2 & missing(m_gmnationfr) } foreach i of numlist 4/9{ replace m_gmnationfr = 1 if a01p_natio1n_`i'==1 & a01p_lientyp_`i'==8 & a01p_sexe_`i'==2 & missing(m_gmnationfr) //grandparent (mother), female french nationality at birth replace m_gmnationfr = 0 if inlist(a01p_natio1n_`i',2,3,4) & a01p_lientyp_`i'==8 & a01p_sexe_`i'==2 & missing(m_gmnationfr) } label var m_gmnationfr "grandmother french nationality at birth (mother)" label define m_gmnationfr 1 "yes" 0 "no" label values m_gmnationfr m_gmnationfr tab m_gmnationfr, missing *4.8. Grandfather born in France (mother) g m_gfbirthfr = 1 if m02m_pblieu==1 replace m_gfbirthfr = 0 if m02m_pblieu==2 foreach i of numlist 4/10{ replace m_gfbirthfr = 1 if m02m_lnais_`i'==1 & m02m_lientyp_`i'==8 & m02m_sexec1_`i'==1 & missing(m_gfbirthfr) //grandparent (mother), male, born in france replace m_gfbirthfr = 0 if m02m_lnais_`i'==2 & m02m_lientyp_`i'==8 & m02m_sexec1_`i'==1 & missing(m_gfbirthfr) } foreach i of numlist 4/10{ replace m_gfbirthfr = 1 if a01m_lnais_`i'==1 & a01m_lientyp_`i'==8 & a01m_sexe_`i'==1 & missing(m_gfbirthfr) //grandparent (mother), male, born in france replace m_gfbirthfr = 0 if a01m_lnais_`i'==2 & a01m_lientyp_`i'==8 & a01m_sexe_`i'==1 & missing(m_gfbirthfr) } replace m_gfbirthfr = 1 if m02p_bplieu==1 & missing(m_gfbirthfr) replace m_gfbirthfr = 0 if m02p_bplieu==2 & missing(m_gfbirthfr) foreach i of numlist 5/9{ replace m_gfbirthfr = 1 if m02p_lnais_`i'==1 & m02p_lientyp_`i'==8 & m02p_sexec1_`i'==1 & missing(m_gfbirthfr) //grandparent (mother), male, born in france replace m_gfbirthfr = 0 if m02p_lnais_`i'==2 & m02p_lientyp_`i'==8 & m02p_sexec1_`i'==1 & missing(m_gfbirthfr) } foreach i of numlist 4/9{ replace m_gfbirthfr = 1 if a01p_lnais_`i'==1 & a01p_lientyp_`i'==8 & a01p_sexe_`i'==1 & missing(m_gfbirthfr) //grandparent (mother), male, born in france replace m_gfbirthfr = 0 if a01p_lnais_`i'==2 & a01p_lientyp_`i'==8 & a01p_sexe_`i'==1 & missing(m_gfbirthfr) } label var m_gfbirthfr "grandfather born in france (mother)" label define m_gfbirthfr 1 "yes" 0 "no" label values m_gfbirthfr m_gfbirthfr tab m_gfbirthfr, missing *4.9. Grandfather french nationality at birth (mother) g m_gfnationfr = 1 if m02m_pbfranc==1 replace m_gfnationfr = 0 if inlist(m02m_pbfranc,2,3,4) foreach i of numlist 4/10{ replace m_gfnationfr = 1 if m02m_natio1n_`i'==1 & m02m_lientyp_`i'==8 & m02m_sexec1_`i'==1 & missing(m_gfnationfr) //grandparent (mother), male french nationality at birth replace m_gfnationfr = 0 if inlist(m02m_natio1n_`i',2,3,4) & m02m_lientyp_`i'==8 & m02m_sexec1_`i'==1 & missing(m_gfnationfr) } foreach i of numlist 4/10{ replace m_gfnationfr = 1 if a01m_natio1n_`i'==1 & a01m_lientyp_`i'==8 & a01m_sexe_`i'==1 & missing(m_gfnationfr) //grandparent (mother), male french nationality at birth replace m_gfnationfr = 0 if inlist(a01m_natio1n_`i',2,3,4) & a01m_lientyp_`i'==8 & a01m_sexe_`i'==1 & missing(m_gfnationfr) } replace m_gfnationfr = 1 if m02p_bpfranc==1 & missing(m_gfnationfr) replace m_gfnationfr = 0 if inlist(m02p_bpfranc,2,3,4) & missing(m_gfnationfr) foreach i of numlist 5/9{ replace m_gfnationfr = 1 if m02p_natio1n_`i'==1 & m02p_lientyp_`i'==8 & m02p_sexec1_`i'==1 & missing(m_gfnationfr) //grandparent (mother), male french nationality at birth replace m_gfnationfr = 0 if inlist(m02p_natio1n_`i',2,3,4) & m02p_lientyp_`i'==8 & m02p_sexec1_`i'==1 & missing(m_gfnationfr) } foreach i of numlist 4/9{ replace m_gfnationfr = 1 if a01p_natio1n_`i'==1 & a01p_lientyp_`i'==8 & a01p_sexe_`i'==1 & missing(m_gfnationfr) //grandparent (mother), male french nationality at birth replace m_gfnationfr = 0 if inlist(a01p_natio1n_`i',2,3,4) & a01p_lientyp_`i'==8 & a01p_sexe_`i'==1 & missing(m_gfnationfr) } label var m_gfnationfr "grandfather french nationality at birth (mother)" label define m_gfnationfr 1 "yes" 0 "no" label values m_gfnationfr m_gfnationfr tab m_gfnationfr, missing *4.10. grandmother born in france (father) g f_gmbirthfr = 1 if m02p_mblieu==1 replace f_gmbirthfr = 0 if m02p_mblieu==2 foreach i of numlist 5/10{ //5/11 replace f_gmbirthfr = 1 if m02p_lnais_`i'==1 & m02p_lientyp_`i'==9 & m02p_sexec1_`i'==2 & missing(f_gmbirthfr) //grandparent (father), female, born in france replace f_gmbirthfr = 0 if m02p_lnais_`i'==2 & m02p_lientyp_`i'==9 & m02p_sexec1_`i'==2 & missing(f_gmbirthfr) } foreach i of numlist 5/10{ replace f_gmbirthfr = 1 if a01p_lnais_`i'==1 & a01p_lientyp_`i'==9 & a01p_sexe_`i'==2 & missing(f_gmbirthfr) //grandparent (father), female, born in france replace f_gmbirthfr = 0 if a01p_lnais_`i'==2 & a01p_lientyp_`i'==9 & a01p_sexe_`i'==2 & missing(f_gmbirthfr) } replace f_gmbirthfr = 1 if m02m_bmlieu==1 & missing(f_gmbirthfr) replace f_gmbirthfr = 0 if m02m_bmlieu==2 & missing(f_gmbirthfr) foreach i of numlist 4/10{ replace f_gmbirthfr = 1 if m02m_lnais_`i'==1 & m02m_lientyp_`i'==9 & m02m_sexec1_`i'==2 & missing(f_gmbirthfr) //grandparent (father), female, born in france replace f_gmbirthfr = 0 if m02m_lnais_`i'==2 & m02m_lientyp_`i'==9 & m02m_sexec1_`i'==2 & missing(f_gmbirthfr) } foreach i of numlist 4/10{ replace f_gmbirthfr = 1 if a01m_lnais_`i'==1 & a01m_lientyp_`i'==9 & a01m_sexe_`i'==2 & missing(f_gmbirthfr) //grandparent (father), female, born in france replace f_gmbirthfr = 0 if a01m_lnais_`i'==2 & a01m_lientyp_`i'==9 & a01m_sexe_`i'==2 & missing(f_gmbirthfr) } label var f_gmbirthfr "grandmother born in france (father)" label define f_gmbirthfr 1 "yes" 0 "no" label values f_gmbirthfr f_gmbirthfr tab f_gmbirthfr, missing *4.11. grandmother french nationality at birth (father) g f_gmnationfr = 1 if m02p_mbfranc==1 replace f_gmnationfr = 0 if inlist(m02p_mbfranc,2,3,4) foreach i of numlist 5/11{ replace f_gmnationfr = 1 if m02p_natio1n_`i'==1 & m02p_lientyp_`i'==9 & m02p_sexec1_`i'==2 & missing(f_gmnationfr) //grandparent (mother), female french nationality at birth replace f_gmnationfr = 0 if inlist(m02p_natio1n_`i',2,3,4) & m02p_lientyp_`i'==9 & m02p_sexec1_`i'==2 & missing(f_gmnationfr) } foreach i of numlist 5/10{ replace f_gmnationfr = 1 if a01p_natio1n_`i'==1 & a01p_lientyp_`i'==9 & a01p_sexe_`i'==2 & missing(f_gmnationfr) //grandparent (mother), female french nationality at birth replace f_gmnationfr = 0 if inlist(a01p_natio1n_`i',2,3,4) & a01p_lientyp_`i'==9 & a01p_sexe_`i'==2 & missing(f_gmnationfr) } replace f_gmnationfr = 1 if m02m_bmfranc==1 & missing(f_gmnationfr) replace f_gmnationfr = 0 if inlist(m02m_bmfranc,2,3,4) & missing(f_gmnationfr) foreach i of numlist 4/10{ replace f_gmnationfr = 1 if m02m_natio1n_`i'==1 & m02m_lientyp_`i'==9 & m02m_sexec1_`i'==2 & missing(f_gmnationfr) //grandparent (mother), female french nationality at birth replace f_gmnationfr = 0 if inlist(m02m_natio1n_`i',2,3,4) & m02m_lientyp_`i'==9 & m02m_sexec1_`i'==2 & missing(f_gmnationfr) } foreach i of numlist 4/10{ replace f_gmnationfr = 1 if a01m_natio1n_`i'==1 & a01m_lientyp_`i'==9 & a01m_sexe_`i'==2 & missing(f_gmnationfr) //grandparent (mother), female french nationality at birth replace f_gmnationfr = 0 if inlist(a01m_natio1n_`i',2,3,4) & a01m_lientyp_`i'==9 & a01m_sexe_`i'==2 & missing(f_gmnationfr) } label var f_gmnationfr "grandmother french nationality at birth (father)" label define f_gmnationfr 1 "yes" 0 "no" label values f_gmnationfr f_gmnationfr tab f_gmnationfr, missing *4.12. grandfather born in france (father) g f_gfbirthfr = 1 if m02p_pblieu==1 replace f_gfbirthfr = 0 if m02p_pblieu==2 foreach i of numlist 5/10{ //5/11 replace f_gfbirthfr = 1 if m02p_lnais_`i'==1 & m02p_lientyp_`i'==9 & m02p_sexec1_`i'==1 & missing(f_gfbirthfr) //grandparent (father), male, born in france replace f_gfbirthfr = 0 if m02p_lnais_`i'==2 & m02p_lientyp_`i'==9 & m02p_sexec1_`i'==1 & missing(f_gfbirthfr) } foreach i of numlist 5/10{ replace f_gfbirthfr = 1 if a01p_lnais_`i'==1 & a01p_lientyp_`i'==9 & a01p_sexe_`i'==1 & missing(f_gfbirthfr) //grandparent (father), male, born in france replace f_gfbirthfr = 0 if a01p_lnais_`i'==2 & a01p_lientyp_`i'==9 & a01p_sexe_`i'==1 & missing(f_gfbirthfr) } replace f_gfbirthfr = 1 if m02m_bplieu==1 & missing(f_gfbirthfr) replace f_gfbirthfr = 0 if m02m_bplieu==2 & missing(f_gfbirthfr) foreach i of numlist 4/10{ replace f_gfbirthfr = 1 if m02m_lnais_`i'==1 & m02m_lientyp_`i'==9 & m02m_sexec1_`i'==1 & missing(f_gfbirthfr) //grandparent (father), male, born in france replace f_gfbirthfr = 0 if m02m_lnais_`i'==2 & m02m_lientyp_`i'==9 & m02m_sexec1_`i'==1 & missing(f_gfbirthfr) } foreach i of numlist 4/10{ replace f_gfbirthfr = 1 if a01m_lnais_`i'==1 & a01m_lientyp_`i'==9 & a01m_sexe_`i'==1 & missing(f_gfbirthfr) //grandparent (father), male, born in france replace f_gfbirthfr = 0 if a01m_lnais_`i'==2 & a01m_lientyp_`i'==9 & a01m_sexe_`i'==1 & missing(f_gfbirthfr) } label var f_gfbirthfr "grandfather born in france (father)" label define f_gfbirthfr 1 "yes" 0 "no" label values f_gfbirthfr f_gfbirthfr tab f_gfbirthfr, missing *4.13. grandfather french nationality at birth (father) g f_gfnationfr = 1 if m02p_pbfranc==1 replace f_gfnationfr = 0 if inlist(m02p_pbfranc,2,3,4) foreach i of numlist 5/11{ replace f_gfnationfr = 1 if m02p_natio1n_`i'==1 & m02p_lientyp_`i'==9 & m02p_sexec1_`i'==1 & missing(f_gfnationfr) //grandparent (father), male french nationality at birth replace f_gfnationfr = 0 if inlist(m02p_natio1n_`i',2,3,4) & m02p_lientyp_`i'==9 & m02p_sexec1_`i'==1 & missing(f_gfnationfr) } foreach i of numlist 5/10{ replace f_gfnationfr = 1 if a01p_natio1n_`i'==1 & a01p_lientyp_`i'==9 & a01p_sexe_`i'==1 & missing(f_gfnationfr) //grandparent (father), male french nationality at birth replace f_gfnationfr = 0 if inlist(a01p_natio1n_`i',2,3,4) & a01p_lientyp_`i'==9 & a01p_sexe_`i'==1 & missing(f_gfnationfr) } replace f_gfnationfr = 1 if m02m_bpfranc==1 & missing(f_gfnationfr) replace f_gfnationfr = 0 if inlist(m02m_bpfranc,2,3,4) & missing(f_gfnationfr) foreach i of numlist 4/10{ replace f_gfnationfr = 1 if m02m_natio1n_`i'==1 & m02m_lientyp_`i'==9 & m02m_sexec1_`i'==1 & missing(f_gfnationfr) //grandparent (father), male french nationality at birth replace f_gfnationfr = 0 if inlist(m02m_natio1n_`i',2,3,4) & m02m_lientyp_`i'==9 & m02m_sexec1_`i'==1 & missing(f_gfnationfr) } foreach i of numlist 4/10{ replace f_gfnationfr = 1 if a01m_natio1n_`i'==1 & a01m_lientyp_`i'==9 & a01m_sexe_`i'==1 & missing(f_gfnationfr) //grandparent (father), male french nationality at birth replace f_gfnationfr = 0 if inlist(a01m_natio1n_`i',2,3,4) & a01m_lientyp_`i'==9 & a01m_sexe_`i'==1 & missing(f_gfnationfr) } label var f_gfnationfr "grandfather french nationality at birth (father)" label define f_gfnationfr 1 "yes" 0 "no" label values f_gfnationfr f_gfnationfr tab f_gfnationfr, missing *4.14. father's lenguage g flenghome = 1 if m02p_lang1e==2 //lenguage spoken at home with the child replace flenghome = 0 if flenghome==. & !inlist(m02p_lang1e,.) replace flenghome = 1 if a01p_lang1e==2 & flenghome==. replace flenghome = 0 if flenghome==. & !inlist(a01p_lang1e,.) label var flenghome "lenguage spoken at home with the child, father" label define flenghome 1 "french" 0 "other" g flengent = 1 if m02p_lang==1 //interview lenguage replace flengent = 0 if flengent==. & !inlist(m02p_lang,.) replace flengent = 1 if a01p_lang==1 & flengent==. //interview lenguage replace flengent = 0 if flengent==. & !inlist(a01p_lang,.) label var flengent "lenguage at interview, father" label define flengent 1 "french" 0 "other" g fleng = 1 if flenghome==1 & flengent==1 replace fleng = 0 if flenghome==0 & flengent==1 //french origin lenguage replace fleng = 0 if flenghome==0 & flengent==0 //foreign lenguage as origin replace fleng = 2 if flenghome==1 & flengent==0 //french at home but foreign lenguage at interview label var fleng "main lenguage" label define fleng 1 "french" 0 "foreign lenguage" 2 "not clear" label values fleng fleng tab fleng, missing *4.15. Grandmother's lenguage (father) g f_gmleng = 1 if m02p_peremlan==1 replace f_gmleng = 0 if f_gmleng==. & !inlist(m02p_peremlan,.) replace f_gmleng = 1 if m02p_mblang==1 & f_gmleng==. replace f_gmleng = 0 if !inlist(m02p_mblang,.) & f_gmleng==. replace f_gmleng = 1 if a01p_peremlan==1 & f_gmleng==. replace f_gmleng = 0 if f_gmleng==. & !inlist(a01p_peremlan,.) replace f_gmleng = 1 if m02m_peremlan==1 & f_gmleng==. replace f_gmleng = 0 if !inlist(m02m_peremlan,.) & f_gmleng==. replace f_gmleng = 1 if m02m_bmlang==1 & f_gmleng==. & m02m_lientyp_4==1 replace f_gmleng = 0 if !inlist(m02m_bmlang,.) & !inlist(m02m_bmlang,1) & !inlist(m02m_bmlang,999) & m02m_lientyp_4==1 //not condition //on missing data, because there are some differences and i tend to trust info on foreign lenguage replace f_gmleng = 1 if a01m_peremlan==1 & f_gmleng==. replace f_gmleng = 0 if !inlist(a01m_peremlan,.) & f_gmleng==. label var f_gmleng "main lenguage grandmother" label define f_gmleng 1 "french" 0 "other lenguage" label values f_gmleng f_gmleng tab f_gmleng *4.16. Grandfather's main lenguage (father) g f_gfleng = 1 if m02p_pereplan==1 replace f_gfleng = 0 if f_gfleng==. & !inlist(m02p_pereplan,.) replace f_gfleng = 1 if m02p_pblang==1 & f_gfleng==. replace f_gfleng = 0 if !inlist(m02p_pblang,.) & f_gfleng==. replace f_gfleng = 1 if a01p_pereplan==1 & f_gfleng==. replace f_gfleng = 0 if f_gfleng==. & !inlist(a01p_pereplan,.) replace f_gfleng = 1 if m02m_pereplan==1 & f_gfleng==. replace f_gfleng = 0 if !inlist(m02m_pereplan,.) & f_gfleng==. replace f_gfleng = 1 if m02m_bplang==1 & f_gfleng==. & m02m_lientyp_4==1 replace f_gfleng = 0 if !inlist(m02m_bplang,.,1,999) & m02m_lientyp_4==1 //not condition //on missing data, because there are some differences and i tend to trust info on foreign lenguage replace f_gfleng = 1 if a01m_pereplan==1 & f_gfleng==. replace f_gfleng = 0 if !inlist(a01m_pereplan,.) & f_gfleng==. label var f_gfleng "main lenguage grandfather father" label define f_gfleng 1 "french" 0 "other" label values f_gfleng f_gfleng tab f_gfleng, missing *4.17. Mother's lenguage g mlenghome = 1 if m02m_lang1e==2 //lenguage spoken at home with the child replace mlenghome = 0 if mlenghome==. & !inlist(m02m_lang1e,.) replace mlenghome = 1 if a01m_lang1e==2 & mlenghome==. //lenguage spoken at home with the child replace mlenghome = 0 if mlenghome==. & !inlist(a01m_lang1e,.) label var mlenghome "lenguage spoken at home with the child, mother" label define mlenghome 1 "french" 0 "other" g mlengent = 1 if m02m_lang==1 //interview lenguage replace mlengent = 0 if mlengent==. & !inlist(m02m_lang,.) replace mlengent = 1 if a01m_lang==1 & mlengent==. //interview lenguage replace mlengent = 0 if mlengent==. & !inlist(a01m_lang,.) label var mlengent "lenguage at interview, mother" label define mlengent 1 "french" 0 "other" g mleng = 1 if mlenghome==1 & mlengent==1 replace mleng = 0 if mlenghome==0 & mlengent==1 //french origin lenguage replace mleng = 0 if mlenghome==0 & mlengent==0 //foreign lenguage as origin replace mleng = 2 if mlenghome==1 & mlengent==0 //french at home but foreign lenguage at interview label var mleng "main lenguage, mother" label define mleng 1 "french" 0 "foreign lenguage" 2 "not clear" label values mleng mleng tab mleng, missing *4.18. Grandmother's lenguage (mother) g m_gmleng = 1 if m02m_meremlan==1 replace m_gmleng = 0 if m_gmleng==. & !inlist(m02m_meremlan,.) replace m_gmleng = 1 if m02m_mblang==1 & m_gmleng==. replace m_gmleng = 0 if !inlist(m02m_mblang,.) & m_gmleng==. replace m_gmleng = 1 if a01m_meremlan==1 & m_gmleng==. replace m_gmleng = 0 if m_gmleng==. & !inlist(a01m_meremlan,.) replace m_gmleng = 1 if m02p_meremlan==1 & m_gmleng==. replace m_gmleng = 0 if !inlist(m02p_meremlan,.) & m_gmleng==. replace m_gmleng = 1 if m02p_bmlang==1 & m_gmleng==. & m02p_lientyp_4==1 replace m_gmleng = 0 if !inlist(m02p_bmlang,.) & !inlist(m02p_bmlang,1) & !inlist(m02p_bmlang,999) & m02p_lientyp_4==1 //not condition //on missing data, because there are some differences and i tend to trust info on foreign lenguage replace m_gmleng = 1 if a01p_meremlan==1 & m_gmleng==. replace m_gmleng = 0 if !inlist(a01p_meremlan,.) & m_gmleng==. label var m_gmleng "main lenguage grandmother, mother" label define m_gmleng 1 "french" 0 "other" label values m_gmleng m_gmleng tab m_gmleng *4.19. Grandfather's lenguage (mother) g m_gfleng = 1 if m02m_mereplan==1 replace m_gfleng = 0 if m_gfleng==. & !inlist(m02m_mereplan,.) replace m_gfleng = 1 if m02m_pblang==1 & m_gfleng==. replace m_gfleng = 0 if !inlist(m02m_pblang,.) & m_gfleng==. replace m_gfleng = 1 if a01m_mereplan==1 & m_gfleng==. replace m_gfleng = 0 if m_gfleng==. & !inlist(a01m_mereplan,.) replace m_gfleng = 1 if m02p_mereplan==1 & m_gfleng==. replace m_gfleng = 0 if !inlist(m02p_mereplan,.) & m_gfleng==. replace m_gfleng = 1 if m02p_bplang==1 & m_gfleng==. & m02p_lientyp_4==1 replace m_gfleng = 0 if !inlist(m02p_bplang,.,1,999) & m02p_lientyp_4==1 //not condition //on missing data, because there are some differences and i tend to trust info on foreign lenguage replace m_gfleng = 1 if a01p_mereplan==1 & m_gfleng==. replace m_gfleng = 0 if !inlist(a01p_mereplan,.) & m_gfleng==. label var m_gfleng "main lenguage grandfather mother" label define m_gfleng 1 "french" 0 "other" label values m_gfleng m_gfleng tab m_gfleng, missing *** Country of origin (immigrant mother) g mctry = m00m2_pays5naism replace mctry = . if inlist(mctry,12) *replace mctry = m02m_pays25nais_3 if inlist(mctry,11,.) *replace mctry = . if inlist(mctry,12) replace mctry = a01m_pays25nais_3 if inlist(mctry,11,.) replace mctry = . if inlist(mctry,12) label var mctry "Mother's country of origin" label define mctry 1 "EU" 2 "Turkey" 3 "Morocco" 4 "Algeria" 5 "Tunisia" 6 "French-speaking Sub-Saharan Africa" 7 "Other Sub-Saharan Africa" 8 "Eastern/Central Europe" 9 "Asia" 10 "South/Central America" 11 "Others" label value mctry mctry tab mctry, missing *tab mctry if mimm==1, missing *** Country of origin (immigrant father) g fctry = m00m2_pays5naisp replace fctry = . if inlist(fctry,12) *replace fctry = m02p_pays25nais_4 if m02p_lientyp_4==1 & inlist(fctry,11,.) *replace fctry = . if inlist(fctry,12) *foreach i of numlist 4/10{ *replace fctry = a01p_pays25nais_`i' if a01p_lientyp_`i'==1 & inlist(fctry,11,.) *} *replace fctry = . if inlist(fctry,12) label var fctry "Father's country of origin" label define fctry 1 "EU" 2 "Turkey" 3 "Morocco" 4 "Algeria" 5 "Tunisia" 6 "French-speaking Sub-Saharan Africa" 7 "Other Sub-Saharan Africa" 8 "Eastern/Central Europe" 9 "Asia" 10 "South/Central America" 11 "Others" label value fctry fctry tab fctry, missing *tab fctry if fimm==1, missing ***************************0. IDENTIFICATION VARS ***************************** * 5.1. Unkown father to ELFE *g father_recogn_child=. *replace father_recogn_child = 1 if m00m2_etatmat==1 & m00m2_couple==1 *replace father_recogn_child = 1 if m00m2_reconu==1 & father_recogn_child==. *replace father_recogn_child = 1 if m02m_recon==1 & father_recogn_child==. *replace father_recogn_child = 0 if m00m2_reconu==0 & father_recogn_child==. *replace father_recogn_child = 0 if m02m_recon==2 & father_recogn_child==. *label var father_recogn_child "father has recognized the child, 2 months" *label define father_recogn_child 0 "no" 1 "yes" *tab father_recogn_child, missing * *g child_hhld = 1 if m02m_efvit==1 *replace child_hhld = 2 if m02m_efvit==2 *replace child_hhld = 3 if m02m_efvit==3 *replace child_hhld = 4 if m02m_efvit==4 *replace child_hhld = 5 if m02m_efvit==5 *replace child_hhld = 6 if inlist(m02m_efvit,6,7) *replace child_hhld = 6 if m02x_typqmere2m==3 & missing(child_hhld) *replace child_hhld = 5 if m02x_typqmere2m==4 & missing(child_hhld) *replace child_hhld = 3 if m02x_typqpecf2m==3 & missing(child_hhld) *replace child_hhld = 6 if m02x_typqpecf2m==5 & missing(child_hhld) *replace child_hhld = 5 if m02x_typqpecf2m==6 & missing(child_hhld) *replace child_hhld = 2 if m02x_typqpecf2m==7 & missing(child_hhld) *replace child_hhld = 6 if m02x_typqpecf2m==8 & missing(child_hhld) *replace child_hhld = 5 if m02x_typqpecf2m==9 & missing(child_hhld) *replace child_hhld = 1 if m02m_lientyp_4==1 & missing(child_hhld) *replace child_hhld = 2 if !inlist(m02m_lientyp_4,1) & missing(child_hhld) *label var child_hhld "person living with the child, 2 months" *label define child_hhld 1 "both father and mother" 2 "mother" 3 "father" 4 /// *"rotating custody" 5 "placed child" 6 "at the hospital" *tab child_hhld, missing *if father is not in the household, the father did not recognise the child, and he did not answer the questionnaire.... g f_unknown = 1 if child_hhld==2 & !inlist(m02p_lientyp_4,1) & father_recogn_child==0 replace f_unknown = 1 if inlist(m02m_infper,2,3,4) & f_unknown==. replace f_unknown = 0 if f_unknown==. lab var f_unknown "the father is unknown to elfe, 2 months" lab define f_unknown 1 "yes" 0 "no" lab values f_unknown f_unknown tab f_unknown, missing *=============================== THE END =====================================