*============================================================================= * 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 ////////////////////2. CREATION OF NEW VARIABLES////////////////////////////// *****************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 values 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 ************************2. FAMILY SITUATION************************************ *2.1 rank of child elfe g rank_elfe=. //we construct this variable starting from very early information and taking into account questionnaire filters 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 * 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 = 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" label values father_recogn_child father_recogn_child tab father_recogn_child, missing * person living with the child 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" label values child_hhld child_hhld tab child_hhld, 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" tab grandpar_2m, 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 * 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/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/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 **** Number of siblings, 2 months 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 ***********************3. SOCIO-ECONOMIC SITUATION***************************** ***. 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 *** 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) 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 } 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 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 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 feduc tab mpeduc_2m, 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 meduc tab fpeduc_2m, missing *** Educational gap between father and mother g educfm = feduc - meduc g educdiff = 2 if educfm>0 //father > mother replace educdiff = 1 if educfm==0 //father = mother replace educdiff = 3 if educfm<0 //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 * 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) 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 } 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.21 father's education - french system g feducaf=. replace feducaf=1 if m02p_diplome_4==1 & m02p_lientyp_4==1 replace feducaf=1 if m02p_diplome_4==2 & m02p_lientyp_4==1 replace feducaf=1 if m02p_diplome_4==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 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 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 *** mother's occupational status 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.3 father's occupational status 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.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 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 *** 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 *** 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 *3.4 professional category of the mother 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, 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.5 self-employment (mother) *we need the variable 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.6 mother working part-time 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 5/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.7 mother working at night 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.8 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.9 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.10 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 purposes 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.11 income per household member 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.12 difficulty making ends meet 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.13 unemployment benefit 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.14 active solidarity benefit 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.15 housing benefits 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.16 social welfare dependency * 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.17 housing type 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.18 house ownership 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 *******************************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 foreach i of numlist 3/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) } 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 foreach i of numlist 3/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) } 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 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) 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 with french nationality replace fnationfr = 0 if inlist(m02p_natio1n_4,2,3,4) & m02p_lientyp_4==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) 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) } 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) } 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) } 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) } 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) } 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) } 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) } 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) } 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) } 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) } 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/10{ //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) } 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) } 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) } 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) } 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/10{ //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) } 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) } 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,.) 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,.) 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 "Father's main lenguage" label define fleng 1 "french" 0 "foreign lenguage" 2 "not clear" label value 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 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 label var f_gmleng "main lenguage grandmother" label define f_gmleng 1 "french" 0 "other lenguage" label value f_gmleng f_gmleng tab f_gmleng, missing *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 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 label var f_gfleng "main lenguage grandfather father" label define f_gfleng 1 "french" 0 "other" label value 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,.) 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,.) 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 value 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 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 label var m_gmleng "main lenguage grandmother, mother" label define m_gmleng 1 "french" 0 "other" tab m_gmleng, missing *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 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 label var m_gfleng "main lenguage grandfather mother" label define m_gfleng 1 "french" 0 "other" tab m_gfleng *** 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) 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) label var fctry "Mother'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 ***************************5. 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 tab f_unknown if months2==1, missing *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 *=============================== THE END =====================================