libname ELFE ".."; /* Folder contaning data path*/ run; libname LIBRARY ".."; /*Folder containing Formats' Library Path*/ run; data data; set Elfe.Input_variables; /*Let be "input_variables" the name of file data*/ run; /*****************1. PREGNANCY AND BIRTH CHARACTERISTICS***********************/ /*1.1 caesarean variable*/ proc format library=Library.formats; value cesarean 0 = "no" 1 = "yes"; run; data data; set data; if m00x_typacc=3 then cesarean=1; if m00x_typacc in (1,2) then cesarean=0; label cesarean ="birth cesarean"; format cesarean cesarean.; run; proc freq data=data; table cesarean; run; /*1.2 father present at birth*/ proc format library=Library.formats; value father_present_birth 0="no" 1="yes"; run; data data; set data; if m00m2_pereacc=1 then father_present_birth=1; if m00m2_pereacc=0 then father_present_birth=0; label father_present_birth = "father present at birth"; format father_present_birth father_present_birth.; run; proc freq data=data; table father_present_birth; run; /*1.3 Child's sex*/ proc format library=Library.formats; value child_sex 1="Male" 0="Female"; run; data data; set data; if m00x_sexec2=2 then child_sex=0; if m00x_sexec2=1 then child_sex=1; if m00x_sexec2=9 then child_sex=.; label child_sex="Sex of Elfe Child"; format child_sex child_sex.; run; proc freq data=data; table child_sex; run; /************************2. FAMILY SITUATION************************************/ /*2.1 rank of child elfe*/ data data; set data; rank_elfe=.; if m00m2_gant=0 then rank_elfe=1; /*never pregnant before -> first baby*/ if m00m2_enfgant=0 then rank_elfe = 1; /*pregnant but abortion or misscarriage -> first baby*/ if rank_elfe = . then rank_elfe = (1 + m00m2_nbgant); /*elfe baby + number of previous children*/ label rank_elfe = "rank of child elfe"; run; proc freq data=data; table rank_elfe; run; /*2.2 Family structure (at birth)*/ proc format library=Library.formats; value familyb 1="married couple" 2="pacse couple" 3="free couple" 4="lone mother"; run; data data; set data; familyb=.; if m00m2_etatmat=1 and m00m2_couple=1 then familyb=1 ; if m00m2_etatmat=2 and m00m2_couple=1 then familyb=2 ; if m00m2_etatmat=3 and m00m2_couple=1 then familyb=3 ; if m00m2_etatmat=4 and m00m2_couple=1 then familyb=3 ; if m00m2_etatmat=5 and m00m2_couple=1 then familyb=3 ; if m00m2_couple=0 then familyb=4; label familyb = "family structure, birth"; format familyb familyb.; run; proc freq data=data; table familyb; run; /*2.3 Family structure (at 2 months)*/ proc format library=Library.formats; value family2m 1="married couple" 2="pacse couple" 3="free couple" 4="lone mother"; run; data data; set data; inhhld = .; %macro test; %do i = 4 %to 6 ; if m02m_lientyp_&i=1 | m02m_lientyp_&i=7 then inhhld=1; %end; %mend; %test; /*There is a father or a coahbitant in the household*/ if inhhld=. and m02m_lientyp_3^=. then inhhld=0 ; /*There is no coahbitant*/ if inhhld=0 then family2m=4; if inhhld=1 & m02m_etamatri in(3,4,5) & family2m=. then family2m = 3; /*free couple. there is a cohabitant, they live in couple but they are not pacses or married*/ if inhhld=1 & m02m_etamatri in(2) & family2m=. then family2m = 2; /*pacse couple. there is a cohabitant and they are pacses*/ if inhhld=1 & m02m_etamatri in(1) & family2m=. then family2m = 1; /*married couple. there is a cohabitant and they are married*/ inhhldp = .; %macro test2; %do i = 3 %to 10 ; if m02p_lientyp_&i=2 then inhhldp=1; %end; %mend; %test2; if m02p_lientyp_4=1 & inhhldp=1 & m02p_etamatri_4 in (3,4,5) & family2m=. then family2m = 3; /*free couple. there is the mother, they live in couple but they are not pacses or married*/ if m02p_lientyp_4=1 & inhhldp=1 & m02p_etamatri_4 in (2) & family2m=. then family2m = 2; /*pacse couple. there is the mother and they are pacses*/ if m02p_lientyp_4=1 & inhhldp=1 & m02p_etamatri_4 in (1) & family2m=. then family2m = 1; /*married couple. there is the mother and they are married*/ label family2m = "family structure, birth, 2 months"; format family2m family2m.; run; proc freq data=data; table family2m; run; /*2.4. Family structure (at 1 year)*/ /*You need family2m*/ proc format library=Library.formats; value family1y 1="married couple" 2="pacse couple" 3="free couple" 4="lone mother"; run; data data; set data; inhhld1 = .; %macro test3; %do i = 4 %to 10 ; if a01m_lientyp_&i=1 | a01m_lientyp_&i=7 then inhhld1=1; %end; %mend; %test3;/*There is a father or a cohabitant in the household*/ if inhhld1=. and a01m_lientyp_3^=. then inhhld1=0 ; /*there is no cohabitant*/ if inhhld1=0 then family1y =4 ; /*lone mother if there is no cohabitant*/ if inhhld1=1 & a01m_couple2=2 & a01m_etamatri=1 & family1y=. then family1y = 1; /* not in couple but marital status married*/ if inhhld1=1 & a01m_couple2=2 & a01m_etamatri=2 & family1y=. then family1y = 2; /* not in couple but marital status pacse*/ if inhhld1=1 & a01m_couple2=2 & a01m_etamatri in(3,4,5) & family1y=. then family1y = 3; /*not in couple but marital status free couple*/ if inhhld1=1 & a01m_couple1=1 & a01m_matricoupm=1 & family1y=. then family1y = family2m; /*in couple and same situation as 2 months*/ if inhhld1=1 & a01m_couple2=1 & a01m_matricouphm=2 & family1y=. then family1y = 3; /*in couple but not married or pacses, free couple*/ if inhhld1=1 & a01m_couple1=1 & a01m_matricoupm=2 & a01m_etamatri=1 & family1y=. then family1y = 1; /*in couple and married*/ if inhhld1=1 & a01m_couple1=1 & a01m_matricoupm=2 & a01m_etamatri=2 & family1y=. then family1y = 2; /*in couple and pacses*/ if inhhld1=1 & a01m_couple1=1 & a01m_matricoupm=2 & a01m_etamatri in (3,4,5) & family1y=. then family1y = 3; /*free couple*/ if inhhld1=1 & a01m_couple2=1 & a01m_matricouphm=1 & a01m_etamatri=1 & family1y=. then family1y = 1; /*in couple and married*/ if inhhld1=1 & a01m_couple2=1 & a01m_matricouphm=1 & a01m_etamatri=2 & family1y=. then family1y = 2; /*in couple and pacse*/ label family1y = "Family structure, 1 year"; format family1y family1y.; run; proc freq data=data; table family1y; run; /*2.5. Not in couple but living together, 2 months*/ /* inhhld needed */ proc format library=Library.formats; value nclt 1="Yes" 0="No"; run; data data; set data; if inhhld=1 & m02m_couple1=2 then nclt = 1; /*no couple, living together. there is a cohabitant but they are not in couple*/ if nclt=. & inhhld^=. then nclt = 0 ; label nclt = "Not in couple but living together, 2 months"; format nclt nclt.; run; proc freq data=data; table nclt; run; /*2.6. Not in couple but living together, 1 year*/ /* inhhld1 needed*/ proc format library=Library.formats; value nclt_1y 1="Yes" 0="No"; run; data data; set data; if inhhld1=1 & a01m_couple1=2 then nclt_1y = 1; /*not in couple but living together*/; if inhhld1=1 & a01m_couple2=2 then nclt_1y = 1; /*not in couple but living together*/; if nclt_1y=. & inhhld1^=. then nclt_1y = 0; label nclt_1y = "Not in couple but living together, 1 year"; format nclt_1y nclt_1y.; run; proc freq data=data; table nclt_1y; run; /*2.7 Father recognized the child*/ proc format library=Library.formats; value father_recogn_child 1="Yes" 0="No"; run; data data; set data; father_recogn_child=.; if m00m2_etatmat=1 & m00m2_couple=1 then father_recogn_child = 1 ; if m00m2_reconu=1 & father_recogn_child=. then father_recogn_child = 1 ; if m02m_recon=1 & father_recogn_child=. then father_recogn_child = 1 ; if a01m_recon=1 & father_recogn_child=. then father_recogn_child = 1 ; if m00m2_reconu=0 & father_recogn_child=. then father_recogn_child = 0; if m02m_recon=2 & father_recogn_child=. then father_recogn_child = 0 ; if a01m_recon=2 & father_recogn_child=. then father_recogn_child = 0 ; format father_recogn_child father_recogn_child.; label father_recogn_child = "father has recognized the child"; run; proc freq data=data; table father_recogn_child; run; /*2.8 Person living with the child, 2 months*/ proc format library=Library.formats; value child_hhld 1="both father and mother" 2="mother" 3="father" 4="rotating custody" 5="foster parents" 6="at the hospital"; run; data data; set data; if m02m_efvit=1 then child_hhld=1; if m02m_efvit=2 then child_hhld=2; if m02m_efvit=3 then child_hhld=3; if m02m_efvit=4 then child_hhld=4; if m02m_efvit=5 then child_hhld=5; if m02m_efvit in (6,7) then child_hhld=6 ; if m02x_typqmere2m=3 & child_hhld=. then child_hhld=6; if m02x_typqmere2m=4 & child_hhld=. then child_hhld=5; if m02x_typqpecf2m=3 & child_hhld=. then child_hhld=3; if m02x_typqpecf2m=5 & child_hhld=. then child_hhld=6; if m02x_typqpecf2m=6 & child_hhld=. then child_hhld=5; if m02x_typqpecf2m=7 & child_hhld=. then child_hhld=2; if m02x_typqpecf2m=8 & child_hhld=. then child_hhld=6; if m02x_typqpecf2m=9 & child_hhld=. then child_hhld=5; if m02m_lientyp_4=1 & child_hhld=. then child_hhld=1; if m02m_lientyp_4^= 1 & child_hhld=. then child_hhld=2; label child_hhld="person living with the child, 2 months"; format child_hhld child_hhld.; run; proc freq data=data; table child_hhld; run; /*2.9. Person living with the child, 1 year*/ proc format library=Library.formats; value child_hhld1y 1="both father and mother" 2="mother" 3="father" 4="rotating custody" 5="foster parents"; run; data data; set data; if a01m_efvit=1 then child_hhld1y = 1; if a01m_efvit=2 & child_hhld1y=. then child_hhld1y=2; if a01m_efvit=3 & child_hhld1y=. then child_hhld1y=3; if a01m_efvit=4 & child_hhld1y=. then child_hhld1y=4; if a01m_efvit=5 & child_hhld1y=. then child_hhld1y=5; %macro test1; %do i = 4 %to 10 ; if a01m_lientyp_&i=1 & child_hhld1y=. then child_hhld1y=1; %end; %mend; %test1; %macro test2; %do i = 4 %to 10 ; if a01m_lientyp_&i^=1 & a01m_lientyp_3=2 & child_hhld1y=. then child_hhld1y=2; %end; %mend; %test2; format child_hhld1y child_hhld1y.; label child_hhld1y = "person living with the child, 1 year"; run; proc freq data=data; table child_hhld1y; run; /* At least one grand-parent in the houshold, 2 months*/ proc format library=Library.formats; value grandpar_2m 1="Yes" 0="No"; run; data data; set data; grandpar_2m = .; %macro test1; %do i = 4 %to 11 ; if m02m_lientyp_&i=8 | m02m_lientyp_&i=9 then grandpar_2m=1 ; if m02p_lientyp_&i in (8,9) & m02m_lientyp_4=1 then grandpar_2m=1; %end; %mend; %test1; if m02m_gdpardom=1 then grandpar_2m=1; if m02p_gdpardom=1 & m02m_lientyp_4=1 then grandpar_2m=1; if m02m_mendomgp=1 then grandpar_2m=1; if m02p_mendomgp=1 & m02m_lientyp_4=1 then grandpar_2m=1; if m02m_gpmaterd^=0 & m02m_gpmaterd ^=. then grandpar_2m=1; if m02p_gppaterd^=0 & m02p_gppaterd ^=. & m02m_lientyp_4=1 then grandpar_2m = 1; %macro test2; %do i = 4 %to 11 ; if m02m_lientyp_&i ^=8 & m02m_lientyp_&i ^=9 & m02m_lientyp_3 ^=. & grandpar_2m=. then grandpar_2m=0; if m02p_lientyp_&i ^=8 & m02p_lientyp_&i ^=9 & m02m_lientyp_4 =1 & grandpar_2m=. then grandpar_2m=0; %end; %mend; %test2; if m02m_gpmaterd=0 & grandpar_2m=. then grandpar_2m=0; if m02p_gppaterd=0 & m02m_lientyp_4=1 & grandpar_2m=. then grandpar_2m=0 ; format grandpar_2m grandpar_2m.; label grandpar_2m = "Having at least one grandparent in the household, 2 months"; run; proc freq data=data; table grandpar_2m; run; /*** At least one grand-parent in the houshold, 1 year*/ /*you need the variable child_hhld1y*/ proc format library=Library.formats; value grandpar_1y 1="Yes" 0="No"; run; data data; set data; grandpar_1y = .; %macro test1; %do i = 4 %to 10 ; if a01m_lientyp_&i=8 | a01m_lientyp_&i=9 then grandpar_1y=1; if a01p_lientyp_&i in(8,9) & child_hhld1y in(1,3,4) then grandpar_1y = 1; %end; %mend; %test1; %macro test2; %do i = 4 %to 10 ; if a01m_lientyp_&i not in(8,9) & a01m_lientyp_3^= . & grandpar_1y=. then grandpar_1y = 0; if a01p_lientyp_&i not in(8,9) & child_hhld1y in (1,3,4) & grandpar_1y=. then grandpar_1y = 0; %end; %mend; %test2; format grandpar_1y grandpar_1y.; label grandpar_1y = "Having at least one grandparent in the household, 1 year"; run; proc freq data=data; table grandpar_1y; run; /* Same sex couple, 2 months*/ proc format library=Library.formats; value samesex_2m 1="Yes" 0="No"; run; data data; set data; samesex_2m = .; %macro test1; /*referent mother with a female partner*/ %do i = 4 %to 6 ; if m02m_sexec1_&i=2 & m02m_lientyp_&i=7 & m02x_typqmere2m in(1,2,3) then samesex_2m = 1; %end; %mend; %test1; %macro test2; /*referent father with a male partner*/ %do i = 4 %to 7 ; if m02p_sexec1_&i=1 & m02p_lientyp_&i=7 & m02x_typqpecf2m in(1,2) then samesex_2m = 1; %end; %mend; %test2; if m02m_lientyp_3=2 & m02x_typqmere2m in(1,2,3) & samesex_2m=. then samesex_2m = 0; /*referent mother who answered*/ if m02p_lientyp_4=1 & m02x_typqpecf2m in(1,2) & samesex_2m=. then samesex_2m = 0; /*referent father who answered*/ label samesex_2m = "Same sex couple in the household, 2 months"; format samesex_2m samesex_2m.; run; proc freq data=data; table samesex_2m; run; /* Same sex couple, 1 Year*/ proc format library=Library.formats; value samesex_1y 1="Yes" 0="No"; run; data data; set data; samesex_1y =.; %macro test1; /*referent mother with a female partner*/ %do i = 4 %to 10 ; if a01m_sexe_&i=2 & a01m_lientyp_&i=7 & a01x_typqmere1a in (1,2,3) then samesex_1y=1; %end; %mend; %test1; %macro test2; %do i = 4 %to 8 ; if a01p_sexe_&i=1 & a01p_lientyp_&i=7 & a01x_typqpecf1a in (1,2) then samesex_1y = 1; %end; %mend; %test2; if a01m_lientyp_3=2 & a01x_typqmere1a in(1,2,3) & samesex_1y=. then samesex_1y = 0; /*referent mother who answered*/ %macro test3; %do i = 4 %to 10 ; if a01p_lientyp_&i=1 & a01x_typqpecf1a in(1,2) & samesex_1y=. then samesex_1y = 0; %end; %mend; %test3; label samesex_1y = "Same sex couple in the household, 1 year"; format samesex_1y samesex_1y.; run; proc freq data=data; table samesex_1y; run; /*Living Apart Together (LAT), 2 mois*/ /*you need the variable child_hhld*/ proc format library=Library.formats; value lat_2m 1="Yes" 0="No"; run; data data; set data; lat_2m = .; if m02m_lientyp_3=2 & m02m_typolog_3 in(2,3,4,5) & child_hhld in(1,5) then lat_2m = 1; /*Parents in the same household, mother not permanently*/ if m02m_lientyp_3=2 & m02m_jouran_3 ne . & m02m_jouran_3<270 & child_hhld in(1,5) then lat_2m = 1; /*Parents in the same household, mother less than 270 days per year in hhld*/ if m02m_lientyp_3=2 & m02m_joursem_3 ne . & m02m_joursem_3<5 & child_hhld in(1,5) then lat_2m = 1; /*Parents in the same household, mother less than 5 days per week in hhld*/ if m02m_lientyp_3=2 & m02m_moisan_3 ne . & m02m_moisan_3<10 & child_hhld in(1,5) then lat_2m = 1; /*Parents in the same household, mother less than 10 months per year in hhld*/ %macro test; %do i=3 %to 6; if m02p_lientyp_&i=2 & m02p_typolog_&i in(2,3,4,5) & child_hhld in (1,5) then lat_2m = 1; /*Parents in the same household, mother not permanently*/ if m02p_lientyp_&i=2 & m02p_jouran_&i ne . & m02p_jouran_&i<270 & child_hhld in(1,5) then lat_2m = 1; /*Parents in the same household, mother less than 270 days per year in hhld*/ if m02p_lientyp_&i=2 & m02p_joursem_&i ne . & m02p_joursem_&i<5 & child_hhld in(1,5) then lat_2m = 1; /*Parents in the same household, mother less than 5 days per week in hhld*/ if m02p_lientyp_&i=2 & m02p_moisan_&i ne . & m02p_moisan_&i<10 & child_hhld in(1,5) then lat_2m = 1; /*Parents in the same household, mother less than 10 months per year in hhld*/ %end; %mend; %test; if m02m_lientyp_4=1 & m02m_typolog_4 in(2,3,4,5) & child_hhld in(1,5) then lat_2m = 1; /*Parents in the same household, father not permanently*/ if m02m_lientyp_4=1 & m02m_jouran_4 ne . & m02m_jouran_4<270 & child_hhld in(1,5) then lat_2m = 1 ; /*Parents in the same household, father less than 270 days per year in hhld*/ if m02m_lientyp_4=1 & m02m_joursem_4 ne .& m02m_joursem_4<5 & child_hhld in(1,5) then lat_2m = 1; /*Parents in the same household, father less than 5 days per week in hhld*/ if m02m_lientyp_4=1 & m02m_moisan_4 ne . & m02m_moisan_4<10 & child_hhld in(1,5) then lat_2m = 1; /*Parents in the same household, father less than 10 months per year in hhld*/ if m02p_lientyp_4=1 & m02p_typolog_4 in(2,3,4,5) & child_hhld in (1,5) then lat_2m = 1; /*Parents in the same household, father not permanently*/ if m02p_lientyp_4=1 & m02p_jouran_4 ne . & m02p_jouran_4<270 & child_hhld in (1,5) then lat_2m = 1; /*Parents in the same household, father less than 270 days per year in hhld*/ if m02p_lientyp_4=1 & m02p_joursem_4 ne . & m02p_joursem_4<5 & child_hhld in(1,5) then lat_2m = 1; /*Parents in the same household, father less than 5 days per week in hhld*/ if m02p_lientyp_4=1 & m02p_moisan_4 ne . & m02p_moisan_4<10 & child_hhld in(1,5) then lat_2m = 1;/*Parents in the same household, father less than 10 months per year in hhld*/ %macro test2; %do i=4 %to 7; if m02m_lientyp_3=2 & m02m_typolog_3 in(2,3,4,5) & m02m_lientyp_&i=7 & child_hhld in(2,4) then lat_2m = 1; /*Child with mother, partner in hhld, she not permanently*/ if m02m_lientyp_3=2 & m02m_jouran_3 ne . & m02m_jouran_3<270 & m02m_lientyp_&i=7 & child_hhld in(2,4) then lat_2m = 1; /*Child with mother, partner in hhld, mother less than 270 days per year in hhld*/ if m02m_lientyp_3=2 & m02m_joursem_3 ne . & m02m_joursem_3<5 & m02m_lientyp_&i=7 & child_hhld in(2,4) then lat_2m = 1; /*Child with mother, partner in hhld, mother less than 5 days per week in hhld*/ if m02m_lientyp_3=2 & m02m_moisan_3 ne . & m02m_moisan_3<10 & m02m_lientyp_&i=7 & child_hhld in(2,4) then lat_2m = 1; /*Child with mother, partner in hhld, mother less than 10 months per year in hhld*/ %end; %mend; %test2; %macro test3; %do i=4 %to 6; if m02m_lientyp_&i=7 & m02m_typolog_&i in(2,3,4,5) & child_hhld in(2,4) then lat_2m = 1; /*Child with mother, partner not permanently*/ if m02m_jouran_&i ne . & m02m_jouran_&i<270 & m02m_lientyp_&i=7 & child_hhld in(2,4) then lat_2m = 1; /*Child with mother, partner less than 270 days per year in hhld*/ if m02m_joursem_&i ne . & m02m_joursem_&i<5 & m02m_lientyp_&i=7 & child_hhld in(2,4) then lat_2m = 1; /*Child with mother, partner less than 5 days per week in hhld*/ if m02m_moisan_&i ne . & m02m_moisan_&i<10 & m02m_lientyp_&i=7 & child_hhld in(2,4) then lat_2m = 1; /*Child with mother, partner less than 10 months per year in hhld*/ %end; %mend; %test3; if m02m_couple2=1 & child_hhld in(2,4,5) then lat_2m = 1; /*there is not partner in hhld, but there is a relationship out of hhld*/ if m02m_situafamm in(2,4,5,6) & child_hhld in(1,2,4,5) then lat_2m = 1 ; %macro test4; %do i=4 %to 7; if m02p_lientyp_4=1 & m02p_typolog_4 in(2,3,4,5) & m02p_lientyp_&i=7 & child_hhld in(3) then lat_2m = 1; /*child with father, partner in hhld, father not permanently*/ if m02p_lientyp_4=1 & m02p_jouran_4 ne . & m02p_jouran_4<270 & m02p_lientyp_&i=7 & child_hhld in(3) then lat_2m = 1; /*child with father, partner in hhld, father less than 270 days per year in hhld*/ if m02p_lientyp_4=1 & m02p_joursem_4 ne . & m02p_joursem_4<5 & m02p_lientyp_&i=7 & child_hhld in(3) then lat_2m = 1; /*child with father, partner in hhld, father less than 5 days per week in hhld*/ if m02p_lientyp_4=1 & m02p_moisan_4 ne . & m02p_moisan_4<10 & m02p_lientyp_&i=7 & child_hhld in(3) then lat_2m = 1; /*child with father, partner in hhld, father less than 10 months per year in hhld*/ %end; %mend; %test4; %macro test5; %do i=4 %to 6; if m02p_lientyp_&i=7 & m02p_typolog_&i in(2,3,4,5) & child_hhld in(3) then lat_2m = 1; /*child with father, partner in hhld but not permanently*/ if m02p_jouran_&i ne . & m02p_jouran_&i<270 & m02p_lientyp_&i=7 & child_hhld in(3)then lat_2m = 1; /*child with father, partner less than 270 days per year in hhld*/ if m02p_joursem_&i ne . & m02p_joursem_&i<5 & m02p_lientyp_&i=7 & child_hhld in(3) then lat_2m = 1; /*child with father, partner less than 5 days per week in hhld*/ if m02p_moisan_&i ne . & m02p_moisan_&i<10 & m02p_lientyp_&i=7 & child_hhld in(3) then lat_2m = 1; /*child with father, partner less than 10 months per year in hhld*/ %end; %mend; %test5; if m02p_situafamp in(2,4,5,6) & child_hhld in(1,3,5) then lat_2m = 1; if m02p_situafamp in(2,4,5,6) & child_hhld=3 then lat_2m = 1 ; if m02m_lientyp_3=2 & lat_2m=. then lat_2m = 0; if m02p_lientyp_4=1 & lat_2m=. then lat_2m = 0; label lat_2m = "Couple Living Apart Together in hhld, 2 months"; format lat_2m lat_2m.; run; proc freq data= data; table lat_2m; run; /*Living Apart Together (LAT), 1 year*/ /*you need the variable child_hhld1y*/ proc format library=Library.formats; value lat_1y 1="Yes" 0="No"; run; data data; set data; lat_1y = .; if a01m_lientyp_3=2 & a01m_typolog_3 in(2,3,4,5) & child_hhld1y in(1,5) then lat_1y = 1; /*Parents in the same household, mother not permanently*/ if a01m_lientyp_3=2 & a01m_jouran_3<270 & child_hhld1y in (1,5) then lat_1y = 1; /*Parents in the same household, mother less than 270 days per year in hhld*/ if a01m_lientyp_3=2 & a01m_joursem_3<5 & child_hhld1y in (1,5) then lat_1y = 1; /*Parents in the same household, mother less than 5 days per week in hhld*/ if a01m_lientyp_3=2 & a01m_moisan_3<10 & child_hhld1y in (1,5) then lat_1y = 1; /*Parents in the same household, mother less than 10 months per year in hhld*/ %macro test1; %do i=3 %to 10; if a01p_lientyp_&i=2 & a01p_typolog_&i in(2,3,4,5) & child_hhld1y in(1,5) then lat_1y = 1; /*Parents in the same household, mother not permanently*/ if a01p_lientyp_&i=2 & a01p_jouran_&i<270 & child_hhld1y in(1,5) then lat_1y = 1; /*Parents in the same household, mother less than 270 days per year in hhld*/ if a01p_lientyp_&i=2 & a01p_joursem_&i<5 & child_hhld1y in(1,5) then lat_1y = 1; /*Parents in the same household, mother less than 5 days per week in hhld*/ if a01p_lientyp_&i=2 & a01p_moisan_&i<10 & child_hhld1y in (1,5) then lat_1y = 1; /*Parents in the same household, mother less than 10 months per year in hhld*/ %end; %mend; %test1; %macro test2; %do i=4 %to 10; if a01m_lientyp_&i=1 & a01m_typolog_&i in(2,3,4,5) & child_hhld1y in(1,5) then lat_1y = 1; /*Parents in the same household, father not permanently*/ if a01m_lientyp_&i=1 & a01m_jouran_&i<270 & child_hhld1y in(1,5) then lat_1y = 1; /*Parents in the same household, father less than 270 days per year in hhld*/ if a01m_lientyp_&i=1 & a01m_joursem_&i<5 & child_hhld1y in(1,5) then lat_1y = 1; /*Parents in the same household, father less than 5 days per week in hhld*/ if a01m_lientyp_&i=1 & a01m_moisan_&i<10 & child_hhld1y in(1,5) then lat_1y = 1; /*Parents in the same household, father less than 10 months per year in hhld*/ %end; %mend; %test2; %macro test3; %do i=4 %to 10; if a01p_lientyp_&i=1 & a01p_typolog_&i in(2,3,4,5) & child_hhld1y in(1,5) then lat_1y = 1; /*Parents in the same household, father not permanently*/ if a01p_lientyp_&i=1 & a01p_jouran_&i<270 & child_hhld1y in(1,5) then lat_1y = 1; /*Parents in the same household, father less than 270 days per year in hhld*/ if a01p_lientyp_&i=1 & a01p_joursem_&i<5 & child_hhld1y in (1,5) then lat_1y = 1; /*Parents in the same household, father less than 5 days per week in hhld*/ if a01p_lientyp_&i=1 & a01p_moisan_&i<10 & child_hhld1y in (1,5) then lat_1y = 1; /*Parents in the same household, father less than 10 months per year in hhld*/ %end; %mend; %test3; %macro test4; %do i=4 %to 10; if a01m_lientyp_3=2 & a01m_typolog_3 in (2,3,4,5) & a01m_lientyp_&i=7 & child_hhld1y in(2,4) then lat_1y = 1 ; /*Child with mother, partner in hhld, she not permanently*/ if a01m_lientyp_3=2 & a01m_jouran_3<270 & a01m_lientyp_&i=7 & child_hhld1y in (2,4) then lat_1y = 1; /*child with mother, partner in hhld, she less than 270 days per year in hhld*/ if a01m_lientyp_3=2 & a01m_joursem_3<5 & a01m_lientyp_&i=7 & child_hhld1y in (2,4) then lat_1y = 1; /*child with mother, partner in hhld, she less than 5 days per week in hhld*/ if a01m_lientyp_3=2 & a01m_moisan_3<10 & a01m_lientyp_&i=7 & child_hhld1y in (2,4) then lat_1y = 1; /*child with mother, partner in hhld, she less than 10 months per year in hhld*/ %end; %mend; %test4 %macro test5; %do i=4 %to 10; if a01m_lientyp_&i=7 & a01m_typolog_&i in (2,3,4,5) & child_hhld1y in (2,4) then lat_1y = 1; /*Child with mother, partner not permanently*/ if a01m_lientyp_&i=7 & a01m_jouran_&i<270 & child_hhld1y in (2,4) then lat_1y = 1; /*child with mother, partner less than 270 days per year in hhld*/ if a01m_lientyp_&i=7 & a01m_joursem_&i<5 & child_hhld1y in (2,4) then lat_1y = 1; /*child with mother, partner less than 5 days per week in hhld*/ if a01m_lientyp_&i=7 & a01m_moisan_&i<10 & child_hhld1y in (2,4) then lat_1y = 1; /*child with mother, partner less than 10 months per year in hhld*/ %end; %mend; %test5; if a01m_couple2=1 & child_hhld1y in (2,4,5) then lat_1y = 1; /*there is not partner in hhld, but there is a relationship out of hhld*/ if a01m_situafamm in (2,4,5,6) & child_hhld1y in (1,2,4,5) then lat_1y = 1; %macro test6; %do i=4 %to 10; if a01p_lientyp_&i=1 & a01p_typolog_&i in(2,3,4,5) & a01p_couple1=1 & child_hhld1y in (3) then lat_1y = 1; /*child with father, partner in hhld, father not permanently*/ if a01p_lientyp_&i=1 & a01p_jouran_&i<270 & a01p_couple1=1 & child_hhld1y in (3) then lat_1y = 1; /*child with father, partner in hhld, he less than 270 days per year in hhld*/ if a01p_lientyp_&i=1 & a01p_joursem_&i<5 & a01p_couple1=1 & child_hhld1y =3 then lat_1y = 1; /*child with father, partner in hhld, he less than 5 days per week in hhld*/ if a01p_lientyp_&i=1 & a01p_moisan_&i<10 & a01p_couple1=1 & child_hhld1y =3 then lat_1y = 1; /*child with father, partner in hhld, he less than 10 months per year in hhld*/ %end; %mend; %test6; %macro test7; %do i=4 %to 8; if a01p_lientyp_&i=7 & a01p_typolog_&i in(2,3,4,5) & child_hhld1y =3 then lat_1y = 1; /*child with father, partner in hhld but not permanently*/ if a01p_lientyp_&i=7 & a01p_jouran_&i<270 & child_hhld1y =3 then lat_1y = 1; /*child with father, partner less than 270 days per year in hhld*/ if a01p_lientyp_&i=7 & a01p_joursem_&i<5 & child_hhld1y=3 then lat_1y = 1; /*child with father, partner less than 5 days per week in hhld*/ if a01p_lientyp_&i=7 & a01p_moisan_&i<10 & child_hhld1y=3 then lat_1y = 1; /*child with father, partner less than 10 months per year in hhld*/ %end; %mend; %test7; if a01p_couple2=1 & child_hhld1y=3 then lat_1y = 1; /*child with father,there is not partner in hhld, but there is a relationship out of hhld*/ if a01p_situafamp in (2,4,5,6) & child_hhld1y in (1,3,5) then lat_1y = 1; if a01p_situafamp in(2,4,5,6) & child_hhld1y=3 then lat_1y = 1; if a01m_lientyp_3=2 & lat_1y=. then lat_1y = 0; if a01p_lientyp_4=1 & lat_1y=. then lat_1y = 0; label lat_1y = "Couple Living Apart Together in hhld, 1 year"; format lat_1y lat_1y.; run; proc freq data=data; table lat_1y; run; /**** Number of siblings, 2 months*/ /*you need months2*/ data data; set data; %macro test; %do i=3 %to 12; enf_2m_&i = .; if m02m_lientyp_&i in (3,4,5,6) then enf_2m_&i = 1; if m02m_lientyp_&i^=. & enf_2m_&i=. then enf_2m_&i=0; if m02p_lientyp_&i in(3,4,5,6) & child_hhld=3 then enf_2m_&i = 1; if m02p_lientyp_&i^=. & enf_2m_&i=. & child_hhld=3 then enf_2m_&i = 0 ; %end; %mend; %test; sib_2m = sum (of enf_2m_4-enf_2m_12); if months2=0 then sib_2m = .; label sib_2m = "Number of siblings, 2 months"; run; proc freq data=data; table sib_2m; run; /**** Number of siblings, 1 year*/ /* you need year1*/ data data; set data; %macro test; %do i=3 %to 10; enf_1y_&i= .; if a01m_lientyp_&i in(3,4,5,6) then enf_1y_&i = 1; if a01m_lientyp_&i^=. & enf_1y_&i =. then enf_1y_&i = 0 ; if a01p_lientyp_&i in(3,4,5,6) & child_hhld1y=3 then enf_1y_&i = 1; if a01p_lientyp_&i^=. & enf_1y_&i=. & child_hhld1y=3 then enf_1y_&i = 0 ; %end; %mend; %test; sib_1y = sum (of enf_1y_4 - enf_1y_10) ; if year1=0 then sib_1y = . ; label sib_1y="Number of siblings, 1 year"; run; proc freq data= data; table sib_1y; run; /***********************3. SOCIO-ECONOMIC SITUATION*****************************/ /** Child age at 1 year survey (in days)*/ /* Set birth date -> day, month, year*/ data data; set data; if m00m1_vague=1 then day = 2 ; if m00m1_vague in (2,3,4) then day = 1 ; if m00m1_vague=1 then month = 4; if m00m1_vague=2 then month = 7 ; if m00m1_vague=3 then month = 10 ; if m00m1_vague=4 then month = 12 ; if m00m1_vague ^=. then year = 2011 ; /* Set 1 year questionnaire date -> day, month, year*/ month_1y = a01m_datintm; year_1y = a01m_datinta; if month_1y=5 & a01m_vague=1 then day_1y = 21 ; if month_1y=6 & a01m_vague=1 then day_1y = 15 ; if month_1y=7 & a01m_vague=1 then day_1y = 15 ; if month_1y=6 & a01m_vague=2 then day_1y = 29 ; if month_1y=7 & a01m_vague=2 then day_1y = 15 ; if month_1y=8 & a01m_vague=2 then day_1y = 15 ; if month_1y=9 & a01m_vague=2 then day_1y = 14 ; if month_1y=9 & a01m_vague=3 then day_1y = 29 ; if month_1y=10 & a01m_vague=3 then day_1y = 15 ; if month_1y=11 & a01m_vague=3 then day_1y = 15 ; if month_1y=12 & a01m_vague=3 then day_1y = 10 ; if month_1y=11 & a01m_vague=4 then day_1y = 29 ; if month_1y=12 & a01m_vague=4 then day_1y = 15 ; if month_1y=1 & a01m_vague=4 then day_1y = 15; if month_1y=2 & a01m_vague=4 then day_1y = 14 ; if month_1y=3 & a01m_vague=4 then day_1y = 1 ; date = mdy(month, day, year); date_1y = mdy(month_1y, day_1y, year_1y); age_1y = date_1y - date; agemois_1y = age_1y/30; label agemois_1y = "Child's age at questionnaire, 1 year"; run; proc freq data=data; table agemois_1y; run; /***. Mother's age, 2 months*/ proc format library=Library.formats; value m_ageg_2m 1=">=25" 2="26-30" 3="31-35" 4="36-40" 5=">40"; run; data data; set data; m_age_2m = m00m2_agem + 0.166; if m_age_2m=. then m_age_2m = m02m_age_3; if m_age_2m=. then m_age_2m = 2011 - m02m_anais_3; %macro test; %do i=3 %to i=10; if m02p_lientyp_&i=2 & m_age_2m=. then m_age_2m = m02p_age_&i ; %end; %mend; %test; %macro test2; %do i=3 %to i=10; if m02p_lientyp_&i=2 & m_age_2m=. then m_age_2m = 2011 - m02p_anais_&i ; %end; %mend; %test2; if m_age_2m^=. then m_age_2m = round(m_age_2m,1); if m_age_2m<18 & m_age_2m^=. then m_age_2m = . ; label m_age_2m = "Mother's age, 2 months"; run; data data; set data; if m_age_2m<26 & m_age_2m^=. then m_ageg_2m = 1 ; if m_age_2m>25.9 & m_age_2m<31 then m_ageg_2m = 2 ; if m_age_2m>30.9 & m_age_2m<36 then m_ageg_2m = 3 ; if m_age_2m>35.9 & m_age_2m<41 then m_ageg_2m = 4 ; if m_age_2m>40.9 & m_age_2m^=. then m_ageg_2m = 5 ; label m_ageg_2m = "Mother's age by group, 2 months"; format m_ageg_2m m_ageg_2m.; run; proc freq data=data; table m_ageg_2m; run; /***. Mother's age, 1 year*/ /*you need m_age_2m*/ proc format library=Library.formats; value m_ageg_1y 1=">=25" 2="26-30" 3="31-35" 4="36-40" 5=">40"; run; data data; set data; m_age_1y = a01m_age_3; if m_age_1y=. then m_age_1y = m_age_2m - 0.166 + (agemois_1y/12) ; if m_age_1y=. & a01m_datinta=2012 then m_age_1y = 2012 - a01m_anais_3 ; /*some questionnaires were done in early 2013*/ if m_age_1y=. & a01m_datinta=2013 then m_age_1y = 2013 - a01m_anais_3; %macro test; %do i=3 %to 10; if a01p_lientyp_&i=2 & m_age_1y=. then m_age_1y = a01p_age_&i ; %end; %mend; %macro test2; %do i=3 %to 10; if a01p_lientyp_&i=2 & m_age_1y=. & a01m_datinta=2012 then m_age_1y = 2012 - a01p_anais_&i; if a01p_lientyp_&i=2 & m_age_1y=. & a01m_datinta=2013 then m_age_1y = 2013 - a01p_anais_&i; %end; %mend; if m_age_1y=. then m_age_1y = m_age_2m + 1; /*we do not know agemois_1y for some*/ if m_age_1y ^=. then m_age_1y = round(m_age_1y,1); if m_age_1y<18 & m_age_1y^=. then m_age_1y = . ; label m_age_1y = "Mother's age, 1 year"; run; proc freq data=data; table m_age_1y; run; data data; set data; if m_age_1y<26 & m_age_1y^=. then m_ageg_1y = 1 ; if m_age_1y>25.9 & m_age_1y<31 then m_ageg_1y = 2 ; if m_age_1y>30.9 & m_age_1y<36 then m_ageg_1y = 3 ; if m_age_1y>35.9 & m_age_1y<41 then m_ageg_1y = 4 ; if m_age_1y>40.9 & m_age_1y^=. then m_ageg_1y = 5 ; label m_ageg_1y = "Mother's age by group, 1 year"; format m_ageg_1y m_ageg_1y.; run; proc freq data=data; table m_ageg_1y; run; /*. Father's age, 2 months*/ proc format library=Library.formats; value f_ageg_2m 1=">=25" 2="26-30" 3="31-35" 4="36-40" 5=">40"; run; data data; set data; f_age_2m = m00m2_agep + 0.166; if m02p_lientyp_4=1 & f_age_2m=. then f_age_2m = m02p_age_4 ; if m02p_lientyp_4=1 & f_age_2m=. then f_age_2m = 2011 - m02p_anais_4 ; if m02m_lientyp_4=1 & f_age_2m=. then f_age_2m = m02m_age_4 ; if m02m_lientyp_4=1 & f_age_2m=. then f_age_2m = 2011 - m02m_anais_4; if f_age_2m^=. then f_age_2m = round(f_age_2m,1); if f_age_2m<14 & f_age_2m^=. then f_age_2m = . ; label f_age_2m = "Father's age, 2 months"; if f_age_2m<26 & f_age_2m^=. then f_ageg_2m = 1 ; if f_age_2m>25.9 & f_age_2m<31 then f_ageg_2m = 2; if f_age_2m>30.9 & f_age_2m<36 then f_ageg_2m = 3; if f_age_2m>35.9 & f_age_2m<41 then f_ageg_2m = 4; if f_age_2m>40.9 & f_age_2m^=. then f_ageg_2m = 5; label f_ageg_2m = "Father's age by group, 2 months"; format f_ageg_2m f_ageg_2m.; run; proc freq data=data; table f_ageg_2m; run; /***. Father's age, 1 year*/ /*You need f_age_2m*/ proc format library=Library.formats; value f_ageg_1y 1=">=25" 2="26-30" 3="31-35" 4="36-40" 5=">40"; run; data data; set data; f_age_1y = .; %macro test; %do i=4 %to 10; if a01p_lientyp_&i=1 then f_age_1y = a01p_age_&i; if f_age_1y=. & a01p_lientyp_&i=1 & a01m_datinta=2012 then f_age_1y = 2012 - a01p_anais_&i; if f_age_1y=. & a01p_lientyp_&i=1 & a01m_datinta=2013 then f_age_1y = 2013 - a01p_anais_&i; if f_age_1y=. then f_age_1y = f_age_2m - 0.166 + (agemois_1y/12); if a01m_lientyp_&i=1 & f_age_1y=. then f_age_1y = a01m_age_&i ; if f_age_1y=. & a01m_lientyp_&i=1 & a01m_datinta=2012 then f_age_1y = 2012 - a01m_anais_&i; if f_age_1y=. & a01m_lientyp_&i=1 & a01m_datinta=2013 then f_age_1y = 2013 - a01m_anais_&i; if f_age_1y=. then f_age_1y = f_age_2m + 1 ; %end; %mend; %test; if f_age_1y^=. then f_age_1y = round(f_age_1y,1); if f_age_1y<14 & f_age_1y^=. then f_age_1y = . ; label f_age_1y = "Father's age, 1 year"; if f_age_1y<26 & f_age_1y^=. then f_ageg_1y = 1 ; if f_age_1y>25.9 & f_age_1y<31 then f_ageg_1y = 2 ; if f_age_1y>30.9 & f_age_1y<36 then f_ageg_1y = 3 ; if f_age_1y>35.9 & f_age_1y<41 then f_ageg_1y = 4 ; if f_age_1y>40.9 & f_age_1y^=. then f_ageg_1y = 5 ; label f_ageg_1y = "Fother's age by group, 1 year"; format f_ageg_1y f_ageg_1y.; run; proc freq data=data; table f_ageg_1y; run; /*** Age difference between mother and father*/ data data; set data; agedif = f_age_2m - m_age_2m; label agedif="Age difference between mother and father (f-m)"; run; proc means data= data; var agedif; run; /*3.1 Mother's education*/ proc format Library=Library.formats; Value meduc 0="none" 1="primary" 2="lower secondary" 3="upper secondary" 4="intermediate" 5="higher"; run; data data; set data; meduc = .; if m02m_diplome_3=1 then meduc=0; if m02m_diplome_3=2 then meduc=1; if m02m_diplome_3=3 then meduc=2 ; if m02m_diplome_3 in( 4, 5, 6) then meduc=3 ; if m02m_diplome_3 in(7) then meduc=4 ; if m02m_diplome_3 in(8) then meduc=5 ; if a01m_diplome_3=1 & meduc=. then meduc=0 ; if a01m_diplome_3=2 & meduc in(0,.) then meduc=1 ; if a01m_diplome_3=3 & meduc in(.,0,1) then meduc=2 ; if a01m_diplome_3 in(4, 5, 6) & meduc in(.,0,1,2) then meduc=3 ; if a01m_diplome_3 in(7) & meduc in(.,0,1,2,3) then meduc=4 ; if a01m_diplome_3 in(8) & meduc in (.,0,1,2,3,4) then meduc=5 ; %macro test; %do i=3 %to 10; if m02p_diplome_&i=1 & meduc=. & m02p_lientyp_&i=2 then meduc=0 ; if m02p_diplome_&i=2 & meduc=. & m02p_lientyp_&i=2 then meduc=1 ; if m02p_diplome_&i=3 & meduc=. & m02p_lientyp_&i=2 then meduc=2 ; if m02p_diplome_&i in(4,5,6) & meduc=. & m02p_lientyp_&i=2 then meduc=3 ; if m02p_diplome_&i in(7) & meduc=. & m02p_lientyp_&i=2 then meduc=4; if m02p_diplome_&i in(8) & meduc=. & m02p_lientyp_&i=2 then meduc=5 ; %end; %mend; %test; %macro test2; %do i=3 %to 10; if a01p_diplome_&i=1 & meduc=. & a01p_lientyp_&i=2 then meduc=0 ; if a01p_diplome_&i=2 & meduc in (0,.) & a01p_lientyp_&i=2 then meduc=1; if a01p_diplome_&i=3 & meduc in (.,0,1) & a01p_lientyp_&i=2 then meduc=2; if a01p_diplome_&i in (4, 5, 6) & meduc in(.,0,1,2) & a01p_lientyp_&i=2 then meduc=3; if a01p_diplome_&i in(7) & meduc in(.,0,1,2,3) & a01p_lientyp_&i=2 then meduc=4; if a01p_diplome_&i in(8) & meduc in(.,0,1,2,3,4) & a01p_lientyp_&i=2 then meduc=5; %end; %mend; %test2; label meduc = "mother's educational attainment - isced"; format meduc meduc.; run; proc freq data=data; table meduc; run; /*3.2 Father's education*/ proc format Library=Library.formats; Value feduc 0="none" 1="primary" 2="lower secondary" 3="upper secondary" 4="intermediate" 5="higher"; run; data data; set data; feduc = .; if m02p_diplome_4=1 & m02p_lientyp_4=1 then feduc=0 ; if m02p_diplome_4=2 & m02p_lientyp_4=1 then feduc=1 ; if m02p_diplome_4=3 & m02p_lientyp_4=1 then feduc=2 ; if m02p_diplome_4 in(4,5,6) & m02p_lientyp_4=1 then feduc=3 ; if m02p_diplome_4=7 & m02p_lientyp_4=1 then feduc=4 ; if m02p_diplome_4=8 & m02p_lientyp_4=1 then feduc=5 ; %macro test; %do i=4 %to 10; if a01p_diplome_&i=1 & a01p_lientyp_&i=1 & feduc=. then feduc=0 ; if a01p_diplome_&i=2 & a01p_lientyp_&i=1 & feduc in(.,0) then feduc=1 ; if a01p_diplome_&i=3 & a01p_lientyp_&i=1 & feduc in(.,0,1) then feduc=2 ; if a01p_diplome_&i in(4,5,6) & a01p_lientyp_&i=1 & feduc in(.,0,1,2) then feduc=3 ; if a01p_diplome_&i=7 & a01p_lientyp_&i=1 & feduc in (.,0,1,2,3) then feduc=4 ; if a01p_diplome_&i=8 & a01p_lientyp_&i=1 & feduc in (.,0,1,2,3,4) then feduc=5; %end; %mend; %test; if m02m_diplome_4=1 & feduc=. & m02m_lientyp_4=1 then feduc=0; if m02m_diplome_4=2 & feduc=. & m02m_lientyp_4=1 then feduc=1; if m02m_diplome_4=3 & feduc=. & m02m_lientyp_4=1 then feduc=2; if m02m_diplome_4 in(4,5,6) & feduc=. & m02m_lientyp_4=1 then feduc=3; if m02m_diplome_4=7 & feduc=. & m02m_lientyp_4=1 then feduc=4; if m02m_diplome_4=8 & feduc=. & m02m_lientyp_4=1 then feduc=5; %macro test2; %do i=4 %to 10; if a01m_diplome_&i=1 & a01m_lientyp_&i=1 & feduc=. then feduc=0 ; if a01m_diplome_&i=2 & a01m_lientyp_&i=1 & feduc in(.,0) then feduc=1 ; if a01m_diplome_&i=3 & a01m_lientyp_&i=1 & feduc in (.,0,1) then feduc=2; if a01m_diplome_&i in (4,5,6) & a01m_lientyp_&i=1 & feduc in(.,0,1,2) then feduc=3 ; if a01m_diplome_&i=7 & a01m_lientyp_&i=1 & feduc in(.,0,1,2,3) then feduc=4; if a01m_diplome_&i=8 & a01m_lientyp_&i=1 & feduc in(.,0,1,2,3,4) then feduc=5 ; %end; %mend; %test2; label feduc="father's educational attainment - isced"; format feduc feduc.; run; proc freq data= data; table feduc; run; /*** Mother's partner education (father or conjoint), 2 months*/ proc format Library=Library.formats; Value mpeduc_2m 0="none" 1="primary" 2="lower secondary" 3="upper secondary" 4="intermediate" 5="higher"; run; data data; set data; if m02m_lientyp_4=1 then mpeduc_2m = feduc ; %macro test; %do i=4 %to 6; if m02m_lientyp_&i=7 & m02m_diplome_&i=1 & mpeduc_2m=. then mpeduc_2m = 0; if m02m_lientyp_&i=7 & m02m_diplome_&i=2 & mpeduc_2m=. then mpeduc_2m = 1; if m02m_lientyp_&i=7 & m02m_diplome_&i=3 & mpeduc_2m=. then mpeduc_2m = 2 ; if m02m_lientyp_&i=7 & m02m_diplome_&i in(4,5,6) & mpeduc_2m=. then mpeduc_2m = 3; if m02m_lientyp_&i=7 & m02m_diplome_&i=7 & mpeduc_2m=. then mpeduc_2m = 4; if m02m_lientyp_&i=7 & m02m_diplome_&i=8 & mpeduc_2m=. then mpeduc_2m = 5; %end; %mend; %test; label mpeduc_2m = "Mother's partner educational attainment - isced (father or current partner at 2 months)"; format mpeduc_2m mpeduc_2m.; run; proc freq data=data; table mpeduc_2m; run; /*** Mother's partner education (father or conjoint), 1 year*/ proc format Library=Library.formats; Value mpeduc_1y 0="none" 1="primary" 2="lower secondary" 3="upper secondary" 4="intermediate" 5="higher"; run; data data; set data; mpeduc_1y = .; %macro test; %do i=4 %to 10; if a01m_lientyp_&i=1 then mpeduc_1y = feduc ; if a01m_lientyp_&i=7 & a01m_diplome_&i=1 & mpeduc_1y=. then mpeduc_1y = 0; if a01m_lientyp_&i=7 & a01m_diplome_&i=2 & mpeduc_1y=. then mpeduc_1y = 1; if a01m_lientyp_&i=7 & a01m_diplome_&i=3 & mpeduc_1y=. then mpeduc_1y = 2; if a01m_lientyp_&i=7 & a01m_diplome_&i in(4,5,6) & mpeduc_1y=. then mpeduc_1y = 3; if a01m_lientyp_&i=7 & a01m_diplome_&i=7 & mpeduc_1y=. then mpeduc_1y = 4; if a01m_lientyp_&i=7 & a01m_diplome_&i=8 & mpeduc_1y=. then mpeduc_1y = 5; %end; %mend; %test; label mpeduc_1y = "Mother's partner educational attainment - isced (father or current partner at 1 year)"; format mpeduc_1y mpeduc_1y.; run; proc freq data=data; table mpeduc_1y; run; /*** Father's partner education (mother or conjoint), 2 months*/ proc format Library=Library.formats; Value fpeduc_2m 0="none" 1="primary" 2="lower secondary" 3="upper secondary" 4="intermediate" 5="higher"; run; data data; set data; fpeduc_2m = .; %macro test; %do i=3 %to 10; if m02p_lientyp_&i=2 then fpeduc_2m = meduc; if m02p_lientyp_&i=7 & m02p_diplome_&i=1 & fpeduc_2m=. then fpeduc_2m = 0; if m02p_lientyp_&i=7 & m02p_diplome_&i=2 & fpeduc_2m=. then fpeduc_2m = 1; if m02p_lientyp_&i=7 & m02p_diplome_&i=3 & fpeduc_2m=. then fpeduc_2m = 2; if m02p_lientyp_&i=7 & m02p_diplome_&i in(4,5,6) & fpeduc_2m=. then fpeduc_2m = 3; if m02p_lientyp_&i=7 & m02p_diplome_&i=7 & fpeduc_2m=. then fpeduc_2m = 4; if m02p_lientyp_&i=7 & m02p_diplome_&i=8 & fpeduc_2m=. then fpeduc_2m = 5; %end; %mend; %test; label fpeduc_2m = "father's partner educational attainment - isced (mother or current partner at 2 months)"; format fpeduc_2m fpeduc_2m.; run; proc freq data=data; table fpeduc_2m; run; /*** Father's partner education (mother or conjoint), 1 year*/ proc format Library=Library.formats; Value fpeduc_1y 0="none" 1="primary" 2="lower secondary" 3="upper secondary" 4="intermediate" 5="higher"; run; data data; set data; fpeduc_1y = .; %macro test2; %do i=3 %to 10; if a01p_lientyp_&i=2 then fpeduc_1y = meduc; if a01p_lientyp_&i=7 & a01p_diplome_&i=1 & fpeduc_1y=. then fpeduc_1y = 0; if a01p_lientyp_&i=7 & a01p_diplome_&i=2 & fpeduc_1y=. then fpeduc_1y = 1; if a01p_lientyp_&i=7 & a01p_diplome_&i=3 & fpeduc_1y=. then fpeduc_1y = 2; if a01p_lientyp_&i=7 & a01p_diplome_&i in(4,5,6) & fpeduc_1y=. then fpeduc_1y = 3; if a01p_lientyp_&i=7 & a01p_diplome_&i=7 & fpeduc_1y=. then fpeduc_1y = 4; if a01p_lientyp_&i=7 & a01p_diplome_&i=8 & fpeduc_1y=. then fpeduc_1y = 5; %end; %mend; %test2; label fpeduc_1y = "father's partner educational attainment - isced (mother or current partner at 1 year)"; format fpeduc_1y fpeduc_1y.; run; proc freq data=data; table fpeduc_1y; run; /*** Educational gap between father and mother*/ proc format Library=Library.formats; Value educdiff 1="Father = Mother" 2="Father > Mother" 3="Mother > Father"; run; data data; set data; educfm = feduc - meduc; if educfm>0 & educfm ne . then educdiff = 2; /*father > mother*/ if educfm=0 & educfm ne . then educdiff = 1; /*father = mother*/ if educfm<0 & educfm ne . then educdiff = 3 ; /* mother > father*/ label educdiff = "Educational gap between father and mother (f-m)"; format educdiff educdiff.; run; proc freq data=data; table educdiff; run; /*** Educational gap between household cohabiting parters, 2 months*/ proc format Library=Library.formats; Value educdiff_2m 1="Father = Mother" 2="Father > Mother" 3="Mother > Father"; run; data data; set data; if child_hhld in(1,4,5,6) then educpm_2m = feduc - meduc ; if child_hhld in(2)then educpm_2m = mpeduc_2m - meduc ; if child_hhld in(3)then educpm_2m = feduc - fpeduc_2m; if educpm_2m>0 & educpm_2m ne . then educdiff_2m = 2; /*father > mother // conjoint > mother // father > conjoint*/ if educpm_2m=0 & educpm_2m ne . then educdiff_2m = 1; /*father = mother // conjoint = mother // father = conjoint*/ if educpm_2m<0 & educpm_2m ne . then educdiff_2m = 3; /*father < mother // conjoint < mother // father < conjoint*/ label educdiff_2m = "Educational gap between household cohabiting partners (father-mother/conj-mother/father-conj)"; format educdiff_2m educdiff_2m.; run; proc freq data= data; table educdiff_2m; run; /*** Educational gap between household cohabiting parters, 1 year*/ proc format Library=Library.formats; Value educdiff_1y; 1="Father = Mother" 2="Father > Mother" 3="Mother > Father"; run; data data; set data; if child_hhld1y in(1,4,5,6) then educpm_1y = feduc - meduc; /*father and mother if child with them*/ if child_hhld1y in(2)then educpm_1y = mpeduc_1y - meduc; /*mother and partner if child with mother*/ if child_hhld1y in (3)then educpm_1y = feduc - fpeduc_1y; /*father and partner if child with father*/ if educpm_1y>0 & educpm_1y ne . then educdiff_1y = 2; /*father > mother // conjoint > mother // father > conjoint*/ if educpm_1y=0 & educpm_1y ne . then educdiff_1y = 1; /*father = mother // conjoint = mother // father = conjoint*/ if educpm_1y<0 & educpm_1y ne . then educdiff_1y = 3; /*father < mother // conjoint < mother // father < conjoint*/ label educdiff_1y = "Educational gap between household cohabiting partners (father-mother/conj-mother/father-conj)"; format educdiff_1y educdiff_1y.; run; proc freq data=data; table educdiff_1y; run; /*3.3 Mother's education - french system*/ proc format Library=Library.formats; Value meducaf 1="<=bepc" 2="cap-bep" 3="bac" 4="bac +2" 5=">bac +2"; run; data data; set data; meducaf=.; if m02m_diplome_3=1 then meducaf=1; if m02m_diplome_3=2 then meducaf=1; if m02m_diplome_3=3 then meducaf=1; if m02m_diplome_3 in (4)then meducaf=2 ; if m02m_diplome_3 in (5,6) then meducaf=3 ; if m02m_diplome_3 in(7)then meducaf=4; if m02m_diplome_3 in(8)then meducaf=5; if a01m_diplome_3 in(1,2,3) & meducaf in(.) then meducaf=1; if a01m_diplome_3 in(4) & meducaf in(.,1) then meducaf=2 ; if a01m_diplome_3 in(5,6) & meducaf in(.,1,2) then meducaf=3 ; if a01m_diplome_3 in(7) & meducaf in(.,1,2,3) then meducaf=4; if a01m_diplome_3 in(8) & meducaf in(.,1,2,3,4) then meducaf=5 ; %macro test; %do i=3 %to 10; if m02p_diplome_&i=1 & meducaf=. & m02p_lientyp_&i=2 then meducaf=1; if m02p_diplome_&i=2 & meducaf=. & m02p_lientyp_&i=2 then meducaf=1; if m02p_diplome_&i=3 & meducaf=. & m02p_lientyp_&i=2 then meducaf=1; if m02p_diplome_&i in(4) & meducaf=. & m02p_lientyp_&i=2 then meducaf=2; if m02p_diplome_&i in(5,6) & meducaf=. & m02p_lientyp_&i=2 then meducaf=3; if m02p_diplome_&i in(7) & meducaf=. & m02p_lientyp_&i=2 then meducaf=4; if m02p_diplome_&i in(8) & meducaf=. & m02p_lientyp_&i=2 then meducaf=5; %end; %mend; %test; %macro test2; %do i=3 %to 10; if a01p_diplome_&i in(1,2,3) & meducaf=. & a01p_lientyp_&i=2 then meducaf=1; if a01p_diplome_&i in(4) & meducaf=. & a01p_lientyp_&i=2 then meducaf=2; if a01p_diplome_&i in(5,6) & meducaf=. & a01p_lientyp_&i=2 then meducaf=3; if a01p_diplome_&i in(7) & meducaf=. & a01p_lientyp_&i=2 then meducaf=4 ; if a01p_diplome_&i in (8) & meducaf=. & a01p_lientyp_&i=2 then meducaf=5; %end; %mend; %test2; label meducaf= "mother's educational attainment - french"; format meducaf meducaf.; run; proc freq data= data; table meducaf; run; /*3.4 Father's education - french system*/ proc format Library=Library.formats; Value feducaf 1="<=bepc" 2="cap-bep" 3="bac" 4="bac +2" 5=">bac +2"; run; data data; set data; feducaf=.; if m02p_diplome_4 in(1,2,3) & m02p_lientyp_4=1 then feducaf=1; if m02p_diplome_4 in(4) & m02p_lientyp_4=1 then feducaf=2; if m02p_diplome_4 in(5,6) & m02p_lientyp_4=1 then feducaf=3; if m02p_diplome_4 in(7) & m02p_lientyp_4=1 then feducaf=4; if m02p_diplome_4 in(8) & m02p_lientyp_4=1 then feducaf=5; %macro test; %do i=4 %to 10; if a01p_diplome_&i in(1,2,3) & a01p_lientyp_&i=1 & feducaf in(.) then feducaf=1; if a01p_diplome_&i in(4) & a01p_lientyp_&i=1 & feducaf in(.,1) then feducaf=2; if a01p_diplome_&i in(5,6) & a01p_lientyp_&i=1 & feducaf in(.,1,2) then feducaf=3; if a01p_diplome_&i in(7) & a01p_lientyp_&i=1 & feducaf in(.,1,2,3) then feducaf=4; if a01p_diplome_&i in(8) & a01p_lientyp_&i=1 & feducaf in(.,1,2,3,4) then feducaf=5; %end; %mend; %test; if m02m_diplome_4 in(1,2,3) & feducaf=. & m02m_lientyp_4=1 then feducaf=1; if m02m_diplome_4=4 & feducaf=. & m02m_lientyp_4=1 then feducaf=2; if m02m_diplome_4 in(5,6) & feducaf=. & m02m_lientyp_4=1 then feducaf=3; if m02m_diplome_4=7 & feducaf=. & m02m_lientyp_4=1 then feducaf=4; if m02m_diplome_4=8 & feducaf=. & m02m_lientyp_4=1 then feducaf=5; %macro test2; %do i=4 %to 10; if a01m_diplome_&i in(1,2,3) & feducaf=. & a01m_lientyp_&i=1 then feducaf=1; if a01m_diplome_&i=4 & feducaf=. & a01m_lientyp_&i=1 then feducaf=2; if a01m_diplome_&i in(5,6) & feducaf=. & a01m_lientyp_&i=1 then feducaf=3; if a01m_diplome_&i=7 & feducaf=. & a01m_lientyp_&i=1 then feducaf=4; if a01m_diplome_&i=8 & feducaf=. & a01m_lientyp_&i=1 then feducaf=5; %end; %mend; %test2; label feducaf = "father's educational attainment - french"; format feducaf feducaf.; run; proc freq data=data; table feducaf; run; /*3.5 Mother's occupational status, 2 months*/ proc format Library=Library.formats; Value mother_occup_status 1="employed" 2="unemployed" 3="other situation (incl. housewife, retired, handicapped pension)" 4="student, apprentice, intern"; run; data data; set data; mother_occup_status=.; if m02m_etudes_3=1 then mother_occup_status=4; if m02m_situae_3 ^=. then mother_occup_status=4 ; if m02m_situa_3=1 then mother_occup_status=1; if m02m_situa_3=2 then mother_occup_status=4; if m02m_situa_3=3 then mother_occup_status=2; if m02m_situa_3=4 then mother_occup_status=3; if m02m_situa_3=5 then mother_occup_status=3; if m02m_situa_3=6 then mother_occup_status=3; if m02m_situa_3=7 then mother_occup_status=3; %macro test; %do i=3 %to 10; if m02p_etudes_&i=1 & m02p_lientyp_&i=2 & mother_occup_status=. then mother_occup_status=4 ; if m02p_situae_&i^=. & m02p_lientyp_&i=2 & mother_occup_status=. then mother_occup_status=4; if m02p_situa_&i=1 & m02p_lientyp_&i=2 & mother_occup_status=. then mother_occup_status=1; if m02p_situa_&i=2 & m02p_lientyp_&i=2 & mother_occup_status=. then mother_occup_status=4; if m02p_situa_&i=3 & m02p_lientyp_&i=2 & mother_occup_status=. then mother_occup_status=2; if m02p_situa_&i=4 & m02p_lientyp_&i=2 & mother_occup_status=. then mother_occup_status=3; if m02p_situa_&i=5 & m02p_lientyp_&i=2 & mother_occup_status=. then mother_occup_status=3; if m02p_situa_&i=6 & m02p_lientyp_&i=2 & mother_occup_status=. then mother_occup_status=3; if m02p_situa_&i=7 & m02p_lientyp_&i=2 & mother_occup_status=. then mother_occup_status=3; %end; %mend; %test; if m02m_congmatpar_3=1 & mother_occup_status=. then mother_occup_status=1; if m02m_congmatpar_3=2 & mother_occup_status=. then mother_occup_status=3; if m02m_congmatpar_3=3 & mother_occup_status=. then mother_occup_status=1; %Macro test2; %do i=3 %to 10; if m02p_congmatpar_&i=1 & m02p_lientyp_&i=2 & mother_occup_status=. then mother_occup_status=1; if m02p_congmatpar_&i=2 & m02p_lientyp_&i=2 & mother_occup_status=. then mother_occup_status=3; if m02p_congmatpar_&i=3 & m02p_lientyp_&i=2 & mother_occup_status=. then mother_occup_status=1; %end; %mend; %test2; label mother_occup_status = "mother's occupational status, 2 months"; format mother_occup_status mother_occup_status.; run; proc freq data=data; table mother_occup_status; run; /*3.6. Mother's occupational status, 1 year*/ proc format Library=Library.formats; Value mother_occup_status1y 1="employed" 2="unemployed" 3="other situation (incl. housewife, retired, handicapped pension)" 4="student, apprentice, intern"; run; data data; set data; mother_occup_status1y = .; if a01m_etudes_3=1 & mother_occup_status1y=. then mother_occup_status1y = 4; if a01m_situae_3^=. & mother_occup_status1y=. then mother_occup_status1y = 4; if a01m_situa_3=1 & mother_occup_status1y=. then mother_occup_status1y = 1; if a01m_situa_3=2 & mother_occup_status1y=. then mother_occup_status1y = 4; if a01m_situa_3=3 & mother_occup_status1y=. then mother_occup_status1y = 2; if a01m_situa_3 in(4,5,6,7) & mother_occup_status1y=. then mother_occup_status1y = 3; %macro test; %do i= 3 %to 10; if a01p_etudes_&i=1 & a01p_lientyp_&i=2 & mother_occup_status1y=. then mother_occup_status1y = 4; if a01p_situae_&i^=. & a01p_lientyp_&i=2 & mother_occup_status1y=. then mother_occup_status1y = 4; if a01p_situa_&i=1 & a01p_lientyp_&i=2 & mother_occup_status1y=. then mother_occup_status1y = 1; if a01p_situa_&i=2 & a01p_lientyp_&i=2 & mother_occup_status1y=. then mother_occup_status1y = 4; if a01p_situa_&i=3 & a01p_lientyp_&i=2 & mother_occup_status1y=. then mother_occup_status1y = 2; if a01p_situa_&i in (4,5,6,7) & a01p_lientyp_&i=2 & mother_occup_status1y=. then mother_occup_status1y = 3; %end; %mend; %test; if a01m_congmatpar_3=1 & mother_occup_status1y=. then mother_occup_status1y = 1; if a01m_congmatpar_3=2 & mother_occup_status1y=. then mother_occup_status1y = 3; if a01m_congmatpar_3=3 & mother_occup_status1y=. then mother_occup_status1y = 1; %macro test2; %do i=3 %to 10; if a01p_congmatpar_&i=1 & a01p_lientyp_&i=2 & mother_occup_status1y=. then mother_occup_status1y = 1; if a01p_congmatpar_&i=2 & a01p_lientyp_&i=2 & mother_occup_status1y=. then mother_occup_status1y = 3; if a01p_congmatpar_&i=3 & a01p_lientyp_&i=2 & mother_occup_status1y=. then mother_occup_status1y = 1; %end; %mend; %test2; label mother_occup_status1y = "Mother's occupational status, 1 year"; format mother_occup_status1y mother_occup_status1y.; run; proc freq data=data; table mother_occup_status1y; run; /*3.7 Father's occupational status, 2 months*/ proc format Library=Library.formats; Value father_occup_status 1="employed" 2="unemployed" 3="other situation (incl. housewife, retired, handicapped pension)" 4="student, apprentice, intern"; run; data data; set data; father_occup_status=.; if m02p_etudes_4=1 & m02p_lientyp_4=1 then father_occup_status=4; if m02p_situae_4 ^=. & m02p_lientyp_4=1 & father_occup_status=. then father_occup_status=4; if m02p_situa_4=1 & m02p_lientyp_4=1 & father_occup_status=. then father_occup_status=1; if m02p_situa_4=2 & m02p_lientyp_4=1 & father_occup_status=. then father_occup_status=4; if m02p_situa_4=3 & m02p_lientyp_4=1 & father_occup_status=. then father_occup_status=2; if m02p_situa_4=4 & m02p_lientyp_4=1 & father_occup_status=. then father_occup_status=3; if m02p_situa_4=5 & m02p_lientyp_4=1 & father_occup_status=. then father_occup_status=3; if m02p_situa_4=6 & m02p_lientyp_4=1 & father_occup_status=. then father_occup_status=3; if m02p_situa_4=7 & m02p_lientyp_4=1 & father_occup_status=. then father_occup_status=3; if m02m_etudes_4=1 & father_occup_status=. & m02m_lientyp_4=1 then father_occup_status=4; if m02m_situae_4^=. & m02p_lientyp_4=1 & father_occup_status=. then father_occup_status=4; if m02m_situa_4=1 & father_occup_status=. & m02m_lientyp_4=1 then father_occup_status=1; if m02m_situa_4=2 & father_occup_status=. & m02m_lientyp_4=1 then father_occup_status=4; if m02m_situa_4=3 & father_occup_status=. & m02m_lientyp_4=1 then father_occup_status=2; if m02m_situa_4=4 & father_occup_status=. & m02m_lientyp_4=1 then father_occup_status=3; if m02m_situa_4=5 & father_occup_status=. & m02m_lientyp_4=1 then father_occup_status=3; if m02m_situa_4=6 & father_occup_status=. & m02m_lientyp_4=1 then father_occup_status=3; if m02m_situa_4=7 & father_occup_status=. & m02m_lientyp_4=1 then father_occup_status=3; if m02p_congmatpar_4=1 & m02p_lientyp_4=1 & father_occup_status=. then father_occup_status=1; if m02p_congmatpar_4=2 & m02p_lientyp_4=1 & father_occup_status=. then father_occup_status=3; if m02p_congmatpar_4=3 & m02p_lientyp_4=1 & father_occup_status=. then father_occup_status=1; if m02m_congmatpar_4=1 & m02m_lientyp_4=1 & father_occup_status=. then father_occup_status=1; if m02m_congmatpar_4=2 & m02m_lientyp_4=1 & father_occup_status=. then father_occup_status=3; if m02m_congmatpar_4=3 & m02m_lientyp_4=1 & father_occup_status=. then father_occup_status=1; if m00m2_emploic=1 & father_occup_status=. then father_occup_status=1; if m00m2_emploic=2 & father_occup_status=. then father_occup_status=3; if m00m2_emploic=3 & father_occup_status=. then father_occup_status=4; if m00m2_emploic=4 & father_occup_status=. then father_occup_status=2; if m00m2_emploic=5 & father_occup_status=. then father_occup_status=3; if m00m2_emploic=6 & father_occup_status=. then father_occup_status=3; if m00m2_emploic=7 & father_occup_status=. then father_occup_status=3; label father_occup_status = "professional situation father, 2 months"; format father_occup_status father_occup_status.; run; proc freq data=data; table father_occup_status; run; /*3.8. Father's occupational status, 1 year*/ proc format Library=Library.formats; Value father_occup_status1y 1="employed" 2="unemployed" 3="other situation (incl. housewife, retired, handicapped pension)" 4="student, apprentice, intern"; run; data data; set data; father_occup_status1y = .; %macro test; %do i=4 %to 10; if a01p_etudes_&i=1 & a01p_lientyp_&i=1 & father_occup_status1y=. then father_occup_status1y = 4; if a01p_situae_&i^=. & a01p_lientyp_&i=1 & father_occup_status1y=. then father_occup_status1y = 4; if a01p_situa_&i=1 & a01p_lientyp_&i=1 & father_occup_status1y=. then father_occup_status1y = 1; if a01p_situa_&i=2 & a01p_lientyp_&i=1 & father_occup_status1y=. then father_occup_status1y = 4; if a01p_situa_&i=3 & a01p_lientyp_&i=1 & father_occup_status1y=. then father_occup_status1y = 2; if a01p_situa_&i in(4,5,6,7) & a01p_lientyp_&i=1 & father_occup_status1y=. then father_occup_status1y = 3; %end; %mend; %test; %macro test2; %do i=4 %to 10; if a01m_etudes_&i=1 & a01m_lientyp_&i=1 & father_occup_status1y=. then father_occup_status1y = 4; if a01m_situae_&i^=. & a01m_lientyp_&i=1 & father_occup_status1y=. then father_occup_status1y = 4; if a01m_situa_&i=1 & a01m_lientyp_&i=1 & father_occup_status1y=. then father_occup_status1y = 1; if a01m_situa_&i=2 & a01m_lientyp_&i=1 & father_occup_status1y=. then father_occup_status1y = 4; if a01m_situa_&i=3 & a01m_lientyp_&i=1 & father_occup_status1y=. then father_occup_status1y = 2; if a01m_situa_&i in (4,5,6,7) & a01m_lientyp_&i=1 & father_occup_status1y=. then father_occup_status1y = 3; %end; %mend; %test2; %macro test3; %do i=4 %to 10; if a01p_congmatpar_&i=1 & a01p_lientyp_&i=1 & father_occup_status1y=. then father_occup_status1y = 1; if a01p_congmatpar_&i=2 & a01p_lientyp_&i=1 & father_occup_status1y=. then father_occup_status1y = 3; if a01p_congmatpar_&i=3 & a01p_lientyp_&i=1 & father_occup_status1y=. then father_occup_status1y = 1; %end; %mend; %test3; %macro test4; %do i=4 %to 10; if a01m_congmatpar_&i=1 & a01m_lientyp_&i=1 & father_occup_status1y=. then father_occup_status1y = 1; if a01m_congmatpar_&i=2 & a01m_lientyp_&i=1 & father_occup_status1y=. then father_occup_status1y = 3; if a01m_congmatpar_&i=3 & a01m_lientyp_&i=1 & father_occup_status1y=. then father_occup_status1y = 1; %end; %mend; %test4; label father_occup_status1y = "Father's occupational status, 1 year"; format father_occup_status1y father_occup_status1y.; run; proc freq data= data; table father_occup_status1y; run; /*3.7 Mother's partner occupational status, 2 months*/ proc format Library=Library.formats; Value mp_occup_2m 1="employed" 2="unemployed" 3="other situation (incl. houseman, retired, handicapped pension, sick leave, paternity leave)" 4="student, apprentice or intern" ; run; data data; set data; mp_occup_2m=. ; if m02m_lientyp_4=1 then mp_occup_2m=father_occup_status; %macro test; %do i=4 %to 6; if m02m_etudes_&i=1 & m02m_lientyp_&i=7 & mp_occup_2m=. then mp_occup_2m=4 ; if m02m_situae_&i^=. & m02m_lientyp_&i=7 & mp_occup_2m=. then mp_occup_2m=4; if m02m_situa_&i=1 & m02m_lientyp_&i=7 & mp_occup_2m=. then mp_occup_2m=1; if m02m_situa_&i=2 & m02m_lientyp_&i=7 & mp_occup_2m=. then mp_occup_2m=4; if m02m_situa_&i=3 & m02m_lientyp_&i=7 & mp_occup_2m=. then mp_occup_2m=2; if m02m_situa_&i in(4,5,6,7) & m02m_lientyp_&i=7 & mp_occup_2m=. then mp_occup_2m=3; if m02m_congmatpar_&i=1 & m02m_lientyp_&i=7 & mp_occup_2m=. then mp_occup_2m=1; if m02m_congmatpar_&i=2 & m02m_lientyp_&i=7 & mp_occup_2m=. then mp_occup_2m=3; if m02m_congmatpar_&i=3 & m02m_lientyp_&i=7 & mp_occup_2m=. then mp_occup_2m=1; %end; %mend; %test label mp_occup_2m = "professional situation mother's partner (father or conjoint), 2 months"; format mp_occup_2m mp_occup_2m.; run; proc freq data=data; table mp_occup_2m; run; /*3.7 Mother's partner occupational status, 1 year*/ proc format Library=Library.formats; Value mp_occup_1y 1="employed" 2="unemployed" 3="other situation (incl. houseman, retired, handicapped pension, sick leave, paternity leave)" 4="student, apprentice or intern" ; run; data data; set data; mp_occup_1y=.; %macro test; %do i=4 %to 10; if a01m_lientyp_&i=1 then mp_occup_1y=father_occup_status1y; if a01m_etudes_&i=1 & a01m_lientyp_&i=7 & mp_occup_1y=. then mp_occup_1y=4; if a01m_situae_&i^=. & a01m_lientyp_&i=7 & mp_occup_1y=. then mp_occup_1y=4; if a01m_situa_&i=1 & a01m_lientyp_&i=7 & mp_occup_1y=. then mp_occup_1y=1; if a01m_situa_&i=2 & a01m_lientyp_&i=7 & mp_occup_1y=. then mp_occup_1y=4; if a01m_situa_&i=3 & a01m_lientyp_&i=7 & mp_occup_1y=. then mp_occup_1y=2; if a01m_situa_&i in(4,5,6,7) & a01m_lientyp_&i=7 & mp_occup_1y=. then mp_occup_1y=3; if a01m_congmatpar_&i=1 & a01m_lientyp_&i=7 & mp_occup_1y=. then mp_occup_1y=1; if a01m_congmatpar_&i=2 & a01m_lientyp_&i=7 & mp_occup_1y=. then mp_occup_1y=3; if a01m_congmatpar_&i=3 & a01m_lientyp_&i=7 & mp_occup_1y=. then mp_occup_1y=1 ; %end; %mend; %test label mp_occup_1y="professional situation mother's partner (father or conjoint), 1 year"; format mp_occup_1y mp_occup_1y.; run; proc freq data=data; table mp_occup_1y; run; /*3.7 Father's partner occupational status, 2 months*/ proc format Library=Library.formats; Value fp_occup_2m 1="employed" 2="unemployed" 3="other situation (incl. houseman, retired, handicapped pension, sick leave, paternity leave)" 4="student, apprentice or intern" ; run; data data; set data; fp_occup_2m=.; %macro test; %do i=3 %to 10; if m02p_lientyp_&i=2 then fp_occup_2m=mother_occup_status; if m02p_etudes_&i=1 & m02p_lientyp_&i=7 & fp_occup_2m=. then fp_occup_2m=4; if m02p_situae_&i^=. & m02p_lientyp_&i=7 & fp_occup_2m=. then fp_occup_2m=4; if m02p_situa_&i=1 & m02p_lientyp_&i=7 & fp_occup_2m=. then fp_occup_2m=1; if m02p_situa_&i=2 & m02p_lientyp_&i=7 & fp_occup_2m=. then fp_occup_2m=4; if m02p_situa_&i=3 & m02p_lientyp_&i=7 & fp_occup_2m=. then fp_occup_2m=2; if m02p_situa_&i in(4,5,6,7) & m02p_lientyp_&i=7 & fp_occup_2m=. then fp_occup_2m=3; if m02p_congmatpar_&i=1 & m02p_lientyp_&i=7 & fp_occup_2m=. then fp_occup_2m=1; if m02p_congmatpar_&i=2 & m02p_lientyp_&i=7 & fp_occup_2m=. then fp_occup_2m=3; if m02p_congmatpar_&i=3 & m02p_lientyp_&i=7 & fp_occup_2m=. then fp_occup_2m=1; %end; %mend; %test; label fp_occup_2m = "professional situation father's partner (mother or conjoint), 2 months"; format fp_occup_2m fp_occup_2m.; run; proc freq data=data; table fp_occup_2m; run; /*3.7 Father's partner occupational status, 1 year*/ proc format Library=Library.formats; Value fp_occup_1y 1="employed" 2="unemployed" 3="other situation (incl. houseman, retired, handicapped pension, sick leave, paternity leave)" 4="student, apprentice or intern" ; run; data data; set data; fp_occup_1y=.; %Macro test; %do i=3 %to 10; if a01p_lientyp_&i=2 then fp_occup_1y=mother_occup_status1y; if a01p_etudes_&i=1 & a01p_lientyp_&i=7 & fp_occup_1y=. then fp_occup_1y=4; if a01p_situae_&i^=. & a01p_lientyp_&i=7 & fp_occup_1y=. then fp_occup_1y=4; if a01p_situa_&i=1 & a01p_lientyp_&i=7 & fp_occup_1y=. then fp_occup_1y=1; if a01p_situa_&i=2 & a01p_lientyp_&i=7 & fp_occup_1y=. then fp_occup_1y=4; if a01p_situa_&i=3 & a01p_lientyp_&i=7 & fp_occup_1y=. then fp_occup_1y=2; if a01p_situa_&i in (4,5,6,7) & a01p_lientyp_&i=7 & fp_occup_1y=. then fp_occup_1y=3; if a01p_congmatpar_&i=1 & a01p_lientyp_&i=7 & fp_occup_1y=. then fp_occup_1y=1; if a01p_congmatpar_&i=2 & a01p_lientyp_&i=7 & fp_occup_1y=. then fp_occup_1y=3; if a01p_congmatpar_&i=3 & a01p_lientyp_&i=7 & fp_occup_1y=. then fp_occup_1y=1; %end; %Mend; %test; label fp_occup_1y = "professional situation father's partner (mother or conjoint), 1 year"; format fp_occup_1y fp_occup_1y.; run; proc freq data=data; table fp_occup_1y; run; /* Parents employment status, 2 months */ proc format Library=Library.formats; Value p_emp_2m 1="At least one parent not working" 2="Both parents not working" 3="Both parents working"; run; Data data; set data; p_emp_2m = .; if mother_occup_status in(2,3,4) | father_occup_status in(2,3,4) then p_emp_2m = 1; if mother_occup_status in(2,3,4) & father_occup_status in(2,3,4) then p_emp_2m = 2; if mother_occup_status=1 & father_occup_status=1 then p_emp_2m = 3; if mother_occup_status in(2,3,4) & child_hhld=2 & p_emp_2m=. then p_emp_2m = 2; if mother_occup_status=1 & child_hhld=2 & p_emp_2m=. then p_emp_2m = 3; if father_occup_status in(2,3,4) & child_hhld=3 & p_emp_2m=. then p_emp_2m = 2; if father_occup_status=1 & child_hhld=3 & p_emp_2m=. then p_emp_2m = 3; label p_emp_2m = "Parents employment status, 2 months"; format p_emp_2m p_emp_2m.; run; proc freq data=data; table p_emp_2m; run; /* Parents employment status , 1 year*/ proc format Library=Library.formats; Value p_emp_1y 1="At least one parent not working" 2="Both parents not working" 3="Both parents working"; run; data data; set data; p_emp_1y = .; if mother_occup_status1y in (2,3,4) | father_occup_status1y in(2,3,4) then p_emp_1y = 1; if mother_occup_status1y in(2,3,4) & father_occup_status1y in(2,3,4) then p_emp_1y = 2; if mother_occup_status1y=1 & father_occup_status1y=1 then p_emp_1y = 3; if mother_occup_status1y in (2,3,4) & child_hhld1y=2 & p_emp_1y=. then p_emp_1y = 2; if mother_occup_status1y=1 & child_hhld1y=2 & p_emp_1y=. then p_emp_1y = 3; if father_occup_status1y in (2,3,4) & child_hhld1y=3 & p_emp_1y=. then p_emp_1y = 2; if father_occup_status1y=1 & child_hhld1y=3 & p_emp_1y=. then p_emp_1y = 3; label p_emp_1y = "Parents employment status, 1 year"; format p_emp_1y p_emp_1y.; run; proc freq data=data; table p_emp_1y; run; /*** Household cohabiting couple employment status, 2 months*/ proc format Library=Library.formats; Value c_emp_2m 1="At least one parent not working" 2="Both parents not working" 3="Both parents working"; run; data data; set data; c_emp_2m = .; if (mother_occup_status in(2,3,4) | father_occup_status in(2,3,4)) & child_hhld in(1,4,5,6) then c_emp_2m = 1; if mother_occup_status in(2,3,4) & father_occup_status in(2,3,4) & child_hhld in(1,4,5,6) then c_emp_2m = 2; if mother_occup_status=1 & father_occup_status=1 & child_hhld in(1,4,5,6) then c_emp_2m = 3; if mother_occup_status in(2,3,4) & mp_occup_2m in(2,3,4) & child_hhld in(2) & c_emp_2m=. then c_emp_2m = 2; if (mother_occup_status in (2,3,4) | mp_occup_2m in(2,3,4)) & child_hhld in(2) & c_emp_2m=. then c_emp_2m = 1; if mother_occup_status=1 & mp_occup_2m=1 & child_hhld in(2) & c_emp_2m=. then c_emp_2m = 3; if fp_occup_2m in(2,3,4) & father_occup_status in (2,3,4) & child_hhld in(3) & c_emp_2m=. then c_emp_2m = 2; if (fp_occup_2m in(2,3,4) | father_occup_status in(2,3,4)) & child_hhld in(3) & c_emp_2m=. then c_emp_2m = 1; if fp_occup_2m=1 & father_occup_status=1 & child_hhld=3 & c_emp_2m=. then c_emp_2m = 3; label c_emp_2m = "Household cohabiting couple employment status, 2 months"; format c_emp_2m c_emp_2m.; run; proc freq data=data; table c_emp_2m; run; /*** Household cohabiting couple employment status, 1 year*/ proc format Library=Library.formats; Value c_emp_1y 1="At least one parent not working" 2="Both parents not working" 3="Both parents working"; run; data data; set data; c_emp_1y = .; if (mother_occup_status1y in(2,3,4) | father_occup_status1y in(2,3,4)) & child_hhld1y in(1,4,5,6) then c_emp_1y = 1; if mother_occup_status1y in(2,3,4) & father_occup_status1y in(2,3,4) & child_hhld1y in(1,4,5,6) then c_emp_1y = 2; if mother_occup_status1y=1 & father_occup_status1y=1 & child_hhld1y in(1,4,5,6) then c_emp_1y = 3; if mother_occup_status1y in(2,3,4) & mp_occup_1y in(2,3,4) & child_hhld1y in(2) & c_emp_1y=. then c_emp_1y = 2; if (mother_occup_status1y in(2,3,4) | mp_occup_1y in(2,3,4)) & child_hhld1y in(2) & c_emp_1y=. then c_emp_1y = 1; if mother_occup_status1y=1 & mp_occup_1y=1 & child_hhld1y in(2) & c_emp_1y=. then c_emp_1y = 3; if fp_occup_1y in(2,3,4) & father_occup_status1y in(2,3,4) & child_hhld1y in(3) & c_emp_1y=. then c_emp_1y = 2; if (fp_occup_1y in(2,3,4) | father_occup_status1y in(2,3,4)) & child_hhld1y in(3) & c_emp_1y=. then c_emp_1y = 1; if fp_occup_1y=1 & father_occup_status1y=1 & child_hhld1y in(3) & c_emp_1y=. then c_emp_1y = 3; label c_emp_1y = "Household cohabiting couple employment status, 1 year"; format c_emp_1y c_emp_1y.; run; proc freq data=data; table c_emp_1y; run; /*3.9 Professional category of the mother, 2 months*/ proc format Library=Library.formats; Value professional_category 1="privately employed" 2="publicly employed" 3="self-employed" 4="other"; run; data data; set data; professional_category=.; if m02m_statut1_3=1 & m02m_statut2_3=1 then professional_category=1; if m02m_statut1_3=1 & m02m_statut2_3=2 then professional_category=2; if m02m_statut1_3=2 then professional_category=3; if m02m_statut1_3=3 then professional_category=4; %macro test; %do i=3 %to 10; if m02p_statut1_&i=1 & m02p_statut2_&i=1 & m02p_lientyp_&i=2 & professional_category=. then professional_category=1; if m02p_statut1_&i=1 & m02p_statut2_&i=2 & m02p_lientyp_&i=2 & professional_category=. then professional_category=2; if m02p_statut1_&i=2 & m02p_lientyp_&i=2 & professional_category=. then professional_category=3; if m02p_statut1_&i=3 & m02p_lientyp_&i=2 & professional_category=. then professional_category=4; %end; %mend; %test; label professional_category = "professional category of the mother, 2 months"; format professional_category professional_category.; run; proc freq data=data; table professional_category; run; /*3.10 Professional category of the mother, 1 year*/ proc format Library=Library.formats; Value prof_cat_1y 1="privately employed" 2="publicly employed" 3="self-employed" 4="other"; run; data data; set data; prof_cat_1y=.; if a01m_statut1_3=1 & a01m_statut2_3=1 then prof_cat_1y=1; if a01m_statut1_3=1 & a01m_statut2_3=2 then prof_cat_1y=2; if a01m_statut1_3=2 then prof_cat_1y=3; if a01m_statut1_3=3 then prof_cat_1y=4; %macro test; %do i= 3 %to 10; if a01p_statut1_&i=1 & a01p_statut2_&i=1 & a01p_lientyp_&i=2 & prof_cat_1y=. then prof_cat_1y=1; if a01p_statut1_&i=1 & a01p_statut2_&i=2 & a01p_lientyp_&i=2 & prof_cat_1y=. then prof_cat_1y=2; if a01p_statut1_&i=2 & a01p_lientyp_&i=2 & prof_cat_1y=. then prof_cat_1y=3; if a01p_statut1_&i=3 & a01p_lientyp_&i=2 & prof_cat_1y=. then prof_cat_1y=4; %end; %mend; %test; label prof_cat_1y="professional category of the mother, 1 year"; format prof_cat_1y prof_cat_1y.; run; proc freq data=data; table prof_cat_1y; run; /*3.11 Self-employment (mother), 2 months*/ /* we need professional_category*/ proc format library=Library.formats; Value self_employed 0="no" 1="yes"; run; data data; set data; self_employed=.; if professional_category=3 then self_employed=1; if professional_category in (1,2,4)then self_employed=0 ; label self_employed = "mother self-employed, 2 months"; format self_employed self_employed.; run; proc freq data=data; table self_employed; run; /*3.12 Self-employment (mother), 1 year*/ /* we need prof_cat_1y*/ proc format Library= Library.formats; Value self_emp_1y 0="no" 1="yes" ; run; data data; set data; self_emp_1y=.; if prof_cat_1y=3 then self_emp_1y=1 ; if prof_cat_1y in(1,2,4) then self_emp_1y=0; label self_emp_1y = "mother self-employed, 1 year"; format self_emp_1y self_emp_1y.; run; proc freq data = data; table self_emp_1y; run; /*3.13 Mother working part-time, 2 months*/ proc format Library= Library.formats; Value mother_work_parttime 0="no" 1="yes" ; run; data data; set data; mother_work_parttime=.; if m02m_empl_3 in(2) then mother_work_parttime=1; if m02m_empl_3 in (1) then mother_work_parttime=0; %macro test; %do i=3 %to 10; if m02p_empl_&i=2 & m02p_lientyp_&i=2 & mother_work_parttime=. then mother_work_parttime=1; if m02p_empl_&i=1 & m02p_lientyp_&i=2 & mother_work_parttime=. then mother_work_parttime=0; %end; %mend; %test; label mother_work_parttime = "mother working parttime, 2 months"; format mother_work_parttime mother_work_parttime.; run; proc freq data=data; table mother_work_parttime; run; /*3.14. Mother working part-time, 1 year*/ proc format Library= Library.formats; Value m_parttime_1y 0="no" 1="yes" ; run; data data; set data; m_parttime_1y=.; if a01m_empl_3 in(2) then m_parttime_1y=1; if a01m_empl_3 in(1) then m_parttime_1y=0; %macro test; %do i=3 %to 10; if a01p_empl_&i=2 & a01p_lientyp_&i=2 & m_parttime_1y=. then m_parttime_1y=1; if a01p_empl_&i=1 & a01p_lientyp_&i=2 & m_parttime_1y=. then m_parttime_1y=0; %end; %mend; %test; label m_parttime_1y = "mother working parttime, 1 year"; format m_parttime_1y m_parttime_1y.; run; proc freq data=data; table m_parttime_1y; run; /*3.15 Mother working at night, 2 months*/ proc format Library=Library.formats; Value mother_work_night 0="no" 1="yes" ; run; data data; set data; mother_work_night=.; if m02m_wnuit=2 then mother_work_night=0; if m02m_wnuit=1 then mother_work_night =1; label mother_work_night = "mother works at night, 2 months"; format mother_work_night mother_work_night.; run; proc freq data=data; table mother_work_night; run; /*3.16 Mother fixed workplace during the pregnancy*/ proc format Library=Library.formats; Value fixed_workplace_preg 0="no" 1="yes" ; run; data data; set data; fixed_workplace_preg=.; if m02m_rfix=2 then fixed_workplace_preg=0; if m02m_rfix=1 then fixed_workplace_preg=1; label fixed_workplace_preg = "fixed workplace during pregnancy"; format fixed_workplace_preg fixed_workplace_preg.; run; proc freq data=data; table fixed_workplace_preg; run; /*3.17 Mother working at home during the pregnancy*/ proc format Library=Library.formats; Value work_home_preg 0="no" 1="yes" ; run; data data; set data; work_home_preg=.; if m02m_trgrdom=2 then work_home_preg=0; if m02m_trgrdom=1 then work_home_preg=1; if m02m_rfix=2 & work_home_preg=. then work_home_preg=0; label work_home_preg = "working from home during the pregnancy"; format work_home_preg work_home_preg.; run; proc freq data=data; table work_home_preg; run; /*3.18 Mother professional outlook*/ proc format Library=Library.formats; Value professional_outlook_mother 1="working" 2="unemployed" 3="Inactive"; run; data data; set data; professional_outlook_mother=.; if m02m_situ in(1, 2, 3) then professional_outlook_mother=1; if m02m_situ in(4, 6) then professional_outlook_mother=2; if m02m_situ in(5, 7, 8) then professional_outlook_mother=3; label professional_outlook_mother = "Mother's professional aim at short term, 2 months"; format professional_outlook_mother professional_outlook_mother.; run; proc freq data=data; table professional_outlook_mother; run; /*3.19 Income per household member, 2 months*/ data data; set data; if m02m_vague < 3 then m02m_datinta = 2011; if m02m_vague=4 then m02m_datinta = 2012; if m02m_datinta=. & m02m_vague=3 then m02m_datinta=(2011+int((2012-2011+1)*rand("Uniform"))); /*randomly assigned 2011,2012 if wave 3*/ %macro test; %do i=3 %to 12; if m02m_anais_&i=9999 | m02m_anais_&i = 8888 then m02m_anais_&i = .; if m02m_anais_&i ^=. then parts_&i = 0.5 *(m02m_datinta - m02m_anais_&i>= 14) + .3 *(m02m_datinta - m02m_anais_&i< 14); if m02m_anais_&i=. then parts_&i = 0; %end; %mend; %test; 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; if parts_tot<1.2 then parts_tot = .; /*minumum value is one adult + the baby 1.3. missing values are wrongly generated with the parts_tot statement. then we correct*/ data data; set data; if m02m_salmon=99999 or m02m_salmon=88888 then m02m_salmon=.; if m02m_salmonc=99999 or m02m_salmonc=88888 then m02m_salmonc=.; if m02p_salmon=99999 or m02p_salmon=88888 then m02p_salmon=.; if m02p_salmonc=99999 or m02p_salmonc=88888 then m02p_salmonc=.; if m02p_totreven=99999 or m02p_totreven=88888 then m02p_totreven=.; if m02m_totreven=99999 or m02m_totreven=88888 then m02m_totreven=.; if m02p_salmonp=9 or m02p_salmonp=8 then m02p_salmonp=.; if m02m_salmonp=9 or m02m_salmonp=8 then m02m_salmonp=.; if m02p_salmoncp=9 or m02p_salmoncp=8 then m02p_salmoncp=.; if m02m_salmoncp=9 or m02m_salmoncp=8 then m02m_salmoncp=.; if m02m_salmonp=2 then m02m_salmon = (m02m_salmon/12); /*making it monthly*/ if m02m_salmoncp=2 then m02m_salmonc = (m02m_salmonc/12); if m02p_salmonp=2 then m02p_salmon = (m02p_salmon/12); if m02p_salmoncp=2 then m02p_salmonc = (m02p_salmonc/12); revenu = m02m_totreven; %macro test2; %do i=3 %to 10; if revenu=. & m02p_lientyp_&i=2 then revenu = m02p_totreven; %end; %mend; %test2; if revenu=. then revenu = (m02m_salmon+m02m_salmonc); %macro test3; %do i=3 %to 10; if revenu=. & m02p_lientyp_&i=2 then revenu = (m02p_salmon+m02p_salmonc); %end; %mend; %test3; if m02m_salmonc=. & m02p_salmon=. & m02p_salmonc=. & revenu=. then revenu = m02m_salmon; /*if only the mother works and it is the only info*/ if m02m_salmon=. & m02p_salmon=. & m02p_salmonc=. & revenu=. then revenu = m02m_salmonc; /*if only the mother' partner works and it is the only info*/ %macro test4; %do i=3 %to 10; if m02p_salmonc=. & m02m_salmon=. & m02m_salmonc=. & revenu=. & m02p_lientyp_&i=2 then revenu = m02p_salmon; /*if only the father works, he lives in couple with the mother and it is the only info*/ if m02p_salmonc=. & m02m_salmon=. & m02m_salmonc=. & revenu=. & m02p_lientyp_&i=2 then revenu = m02p_salmon; /*if only the father's partner (mother) works and it is the only info*/ %end; %mend; %test4; if m02m_loyer in(9999,99999) then m02m_loyer = .; if m02p_loyer in (9999,99999) then m02p_loyer = .; if m02m_imom in (9999,99999) then m02m_imom = .; if m02p_imom in (9999,99999) then m02p_imom = .; if m02m_imoan in (9999,99999) then m02m_imoan = .; if m02p_imoan in(9999,99999) then m02p_imoan = .; hcosts = m02m_loyer; %macro test5; %do i=3 %to 10; if hcosts=. & m02p_lientyp_&i=2 then hcosts = m02p_loyer; %end; %mend; %test5; if m02m_imom=. then m02m_imom = m02m_imoan/12; if m02p_imom=. then m02p_imom = m02p_imoan/12; if hcosts=. then hcosts = m02m_imom; %macro test6; %do i=3 %to 10; if hcosts=. & m02p_lientyp_&i=2 then hcosts = m02p_imom; %end; %mend; %test6; if m02m_stoc=3 & hcosts=. then hcosts = 0; %macro test7; %do i=3 %to 10; if m02p_stoc=3 & hcosts=. & m02p_lientyp_&i=2 then hcosts = 0; %end; %mend; %test7; if hcosts>2000 & hcosts>revenu then hcosts = .; disinc = revenu - hcosts; disinc_part = disinc/parts_tot; label disinc_part = "Disposable income per household member, 2 months"; rev_part = revenu / parts_tot; label rev_part = "income per household member, 2 months"; format disinc_part disinc_part.; run; proc means data=data; Var disinc_part; run; proc means data=data; Var rev_part; run; proc rank data=data out=data_SORTIE GROUPS=5; var disinc_part; RANKS Q ; run; proc rank data=data out=data_SORTIE2 GROUPS=10; var disinc_part; RANKS P ; run; proc means data=data_SORTIE mean;/*Quantiles of disposable income per hhld member, 2 months*/ var disinc_part; class Q; run; proc means data=data_SORTIE2 mean;/*Deciles of disposable income per hhld member, 2 months*/ var disinc_part; class P; run; /*3.20. Income per household member, 1 year*/ data data; set data; if m02m_vague < 3 then m02m_datinta = 2011; if m02m_vague = 4then m02m_datinta = 2012; if m02m_datinta=. & m02m_vague = 3 then m02m_datinta = (2011+int((2012-2011+1)*rand("Uniform"))); /*randomly assigned 2011,2012 if wave 3*/ %macro test1; %do i= 3 %to 10; if a01m_anais_&i= 9999 | a01m_anais_&i= 8888 then a01m_anais_&i= .; if a01m_anais_&i^=. then parts1y_&i = (0.5 *(m02m_datinta - a01m_anais_&i>= 14) + 0.3 *(m02m_datinta - a01m_anais_&i< 14)); if a01m_anais_&i=. then parts1y_&i = 0; %end; %mend; %test1; parts_tot1y = 0.5 + 0.3 + (m00m2_nais = 1)*.3 + parts1y_3 + parts1y_4 + parts1y_5 + parts1y_6 + parts1y_7 + parts1y_8 + parts1y_9 + parts1y_10; if parts_tot1y<1.2 then parts_tot1y = .; /*minumum value is one adult + the baby 1.3. missing values are wrongly generated with the parts_tot statement. then we correct*/ if a01m_salmon=99999 or a01m_salmon=88888 then a01m_salmon=.; if a01m_salmonc=99999 or a01m_salmonc=88888 then a01m_salmonc=.; if a01p_salmon=99999 or a01p_salmon=88888 then a01p_salmon=.; if a01p_salmonc=99999 or a01p_salmonc=88888 then a01p_salmonc=.; if a01p_totreven=99999 or a01p_totreven=88888 then a01p_totreven=.; if a01m_totreven=99999 or a01m_totreven=88888 then a01m_totreven=.; if a01p_salmonp=9 or a01p_salmonp=8 then a01p_salmonp=.; if a01m_salmonp=9 or a01m_salmonp=8 then a01m_salmonp=.; if a01p_salmoncp=9 or a01p_salmoncp=8 then a01p_salmoncp=.; if a01m_salmoncp=9 or a01m_salmoncp=8 then a01m_salmoncp=.; if a01m_salmonp=2 then a01m_salmon = (a01m_salmon/12); /*making it monthly*/ if a01m_salmoncp=2 then a01m_salmonc = (a01m_salmonc/12); if a01p_salmonp=2 then a01p_salmon = (a01p_salmon/12); if a01p_salmoncp=2 then a01p_salmonc = (a01p_salmonc/12); revenu1y = a01m_totreven; %macro test2; %do i=3 %to 10; if revenu1y=. & a01p_lientyp_&i=2 then revenu1y = a01p_totreven; %end; %mend; %test2; if revenu1y=. then revenu1y = (a01m_salmon+a01m_salmonc); %macro test3; %do i=3 %to 10; if revenu1y=. & a01p_lientyp_&i=2 then revenu1y = (a01p_salmon+a01p_salmonc); %end; %mend; %test3; if a01m_salmonc=. & a01p_salmon=. & a01p_salmonc=. & revenu1y=. then revenu1y = a01m_salmon; /*if only the mother works and it is the only info*/ if a01m_salmon=. & a01p_salmon=. & a01p_salmonc=. & revenu1y=. then revenu1y = a01m_salmonc; /*if only the mother' partner works and it is the only info*/ %macro test4; %do i=3 %to 10; if a01p_salmonc=. & a01m_salmon=. & a01m_salmonc=. & revenu1y=. & a01p_lientyp_&i=2 then revenu1y = a01p_salmon; /*if only the father works, he lives in couple with the mother and it is the only info*/ if a01p_salmonc=. & a01m_salmon=. & a01m_salmonc=. & revenu1y=. & a01p_lientyp_&i=2 then revenu1y = a01p_salmon; /*if only the father's partner (mother) works and it is the only info*/ %end; %mend; %test4; if a01m_loyer in(9999,99999) then a01m_loyer = .; if a01p_loyer in(9999,99999) then a01p_loyer = .; if a01m_qempr in(9999,99999) then a01m_qempr = .; if a01p_qempr in(9999,99999) then a01p_qempr = .; hcosts1 = a01m_loyer; %macro test5; %do i=3 %to 10; if hcosts1=. & a01p_lientyp_&i=2 then hcosts1 = a01p_loyer; %end; %mend; %test5; if a01m_empr=2 & hcosts1=. then hcosts1 = 0; %macro test6; %do i=3 %to 10; if a01p_empr=2 & hcosts1=. & a01p_lientyp_&i=2 then hcosts1 = 0; %end; %mend; %test6; if hcosts1=. then hcosts1 = a01m_qempr; %macro test7; %do i=3 %to 10; if hcosts1=. & a01p_lientyp_&i=2 then hcosts1 = a01p_qempr; %end; %mend; %test7; if a01m_stoc in (3,4,5,6) & hcosts1=. then hcosts1 = 0; %macro test8; %do i=3 %to 10; if a01p_stoc in(3,4,5,6) & hcosts1=. & a01p_lientyp_&i=2 then hcosts1 = 0; %end; %mend; %test8; if demenag=0 & hcosts1=. then hcosts1 = hcosts; if hcosts1>2000 & hcosts1>revenu1y then hcosts1 = .; disinc1 = revenu1y - hcosts1; disinc_part1 = disinc1/parts_tot1y; label disinc_part1 = "disposable income per household member, 1 year"; rev_part1 = revenu1y/parts_tot1y; label rev_part1 = "Income per household member, 1 year"; run; proc means data=data; Var disinc_part1; run; proc means data=data; Var rev_part1; run; proc rank data=data out=data_SORTIE3 GROUPS=5; var disinc_part1; RANKS V ; run; proc rank data=data out=data_SORTIE4 GROUPS=10; var disinc_part1; RANKS W ; run; proc means data=data_SORTIE3 mean;/*Quantiles of disposable income per hhld member, 1 year*/ var disinc_part1; class V; run; proc means data=data_SORTIE4 mean;/*Deciles of disposable income per hhld member, 1 year*/ var disinc_part1; class W; run; /*3.21 Difficulty making ends meet, 2 months*/ proc format Library=Library.formats; Value diff_making_ends 0="no difficulty" 1="difficulty"; run; data data; set data; diff_making_ends=.; if m02m_actfi in(1,2,3) then diff_making_ends=0; if m02m_actfi in(4,5) then diff_making_ends=1; %macro test; %do i=3 %to 10; if m02p_actfi in(1,2,3) & diff_making_ends=. & m02p_lientyp_&i=2 then diff_making_ends=0; if m02p_actfi in(4,5) & diff_making_ends=. & m02p_lientyp_&i=2 then diff_making_ends=1; %end; %mend; %test; label diff_making_ends = "difficulty making ends meet, 2 months"; format diff_making_ends diff_making_ends.; run; proc freq data = data; table diff_making_ends; run; /*3.22 Unemployment benefit, 2 months*/ proc format Library=Library.formats; Value unemployment_benefit 0="No" 1="Yes"; run; data data; set data; unemployment_benefit=.; if m02m_rcho=1 then unemployment_benefit=1; if m02m_rcho=2 then unemployment_benefit=0; %macro test; %do i=3 %to 10; if m02p_rcho=1 & unemployment_benefit=. & m02p_lientyp_&i=2 then unemployment_benefit=1; if m02p_rcho=2 & unemployment_benefit=. & m02p_lientyp_&i=2 then unemployment_benefit=0; %end; %mend; %test; label unemployment_benefit = "unemployment benefit, 2 months"; format unemployment_benefit unemployment_benefit.; run; proc freq data= data; table unemployment_benefit; run; /*3.23 unemployment benefit, 1 year*/ proc format Library=Library.formats; Value unemployment_benefit1y 0="No" 1="Yes"; run; data data; set data; unemployment_benefit1y=.; if a01m_rcho=1 then unemployment_benefit1y=1; if a01m_rcho=2 then unemployment_benefit1y=0; %macro test; %do i=3 %to 10; if a01p_rcho=1 & unemployment_benefit1y=. & a01p_lientyp_&i=2 then unemployment_benefit1y=1; if a01p_rcho=2 & unemployment_benefit1y=. & a01p_lientyp_&i=2 then unemployment_benefit1y=0; %end; %mend; %test; %test; label unemployment_benefit1y = "unemployment benefit, 1 year"; format unemployment_benefit1y unemployment_benefit1y.; run; proc freq data= data; table unemployment_benefit1y; run; /*3.24 Active solidarity Benefit, 2 months*/ proc format Library=Library.formats; Value active_solidarity_benefit 0="no" 1="yes"; run; data data; set data; active_solidarity_benefit=.; if m02m_rrsa=1 then active_solidarity_benefit=1; if m02m_rrsa=2 then active_solidarity_benefit=0; %macro test; %do i=3 %to 10; if m02p_rrsa=1 & active_solidarity_benefit=. & m02p_lientyp_&i=2 then active_solidarity_benefit=1; if m02p_rrsa=2 & active_solidarity_benefit=. & m02p_lientyp_&i=2 then active_solidarity_benefit=0; %end; %mend; %test; label active_solidarity_benefit = "active solidarity benefit, 2 months"; format active_solidarity_benefit active_solidarity_benefit.; run; proc freq data =data; table active_solidarity_benefit; run; /*3.25 active solidarity benefit, 1 year*/ proc format Library=Library.formats; Value active_solidarity_benefit1y 0="no" 1="yes"; run; data data; set data; active_solidarity_benefit1y=.; if a01m_rrsa=1 then active_solidarity_benefit1y=1 ; if a01m_rrsa=2 then active_solidarity_benefit1y=0 ; %macro test; %do i=3 %to 10; if a01p_rrsa=1 & active_solidarity_benefit1y=. & a01p_lientyp_&i=2 then active_solidarity_benefit1y=1; if a01p_rrsa=2 & active_solidarity_benefit1y=. & a01p_lientyp_&i=2 then active_solidarity_benefit1y=0; %end; %mend; %test; label active_solidarity_benefit1y = "active solidarity benefit, 1 year"; format active_solidarity_benefit1y active_solidarity_benefit1y.; run; proc freq data=data; table active_solidarity_benefit1y; run; /*3.26 Housing benefits, 2 months*/ proc format Library=Library.formats; Value housing_benefit 0="no" 1="yes"; run; data data; set data; housing_benefit=.; if m02m_rlog=1 then housing_benefit=1; if m02m_rlog=2 then housing_benefit=0; %macro test; %do i= 3 %to 10; if m02p_rlog=1 & housing_benefit=. & m02p_lientyp_&i=2 then housing_benefit=1; if m02p_rlog=2 & housing_benefit=. & m02p_lientyp_&i=2 then housing_benefit=0; %end; %mend; %test; label housing_benefit = "housing benefit, 2 months"; format housing_benefit housing_benefit.; run; proc freq data=data; table housing_benefit; run; /*3.27 housing benefits, 1 year*/ proc format Library=Library.formats; Value housing_benefit1y 0="no" 1="yes"; run; data data; set data; housing_benefit1y=.; if a01m_rlog=1 then housing_benefit1y=1; if a01m_rlog=2 then housing_benefit1y=0; %macro test; %do i=3 %to 10; if a01p_rlog=1 & housing_benefit1y=. & a01p_lientyp_&i=2 then housing_benefit1y=1 ; if a01p_rlog=2 & housing_benefit1y=. & a01p_lientyp_&i=2 then housing_benefit1y=0; %end; %mend; %test; label housing_benefit1y = "housing benefit, 1 year"; format housing_benefit1y housing_benefit1y.; run; proc freq data=data; table housing_benefit1y; run; /*3.28 Social Welfare dependency, 2 months*/ /* we need unemployment_benefit, housing_benefit and active_solidarity_benefit*/ proc format Library=Library.formats; Value social_welfare_dependency 0="no" 1="yes"; run; data data; set data; social_welfare_dependency=.; if unemployment_benefit=1 | housing_benefit=1 | active_solidarity_benefit=1 then social_welfare_dependency=1; if unemployment_benefit=0 & housing_benefit=0 & active_solidarity_benefit=0 then social_welfare_dependency=0; label social_welfare_dependency = "social welfare dependency, 2 months"; format social_welfare_dependency social_welfare_dependency.; run; proc freq data=data; table social_welfare_dependency; run; /*3.29 social welfare dependency, 1 year*/ /*we need unemployment_benefit1y, housing_benefit1y and active_solidarity_benefit1y*/ proc format Library=Library.formats; Value social_welfare_dependency1y 0="no" 1="yes"; run; data data; set data; social_welfare_dependency1y=.; if unemployment_benefit1y=1 | housing_benefit1y=1 | active_solidarity_benefit1y=1 then social_welfare_dependency1y=1; if unemployment_benefit1y=0 & housing_benefit1y=0 & active_solidarity_benefit1y=0 then social_welfare_dependency1y=0; label social_welfare_dependency1y = "social welfare dependency, 1 year"; format social_welfare_dependency1y social_welfare_dependency1y.; run; proc freq data=data; table social_welfare_dependency1y; run; /******* 4. Houising situation of the household ******/ /*3.30 Housing type, 2 months*/ proc format Library=Library.formats; Value house_type 1="house" 2="apartment" 3="other"; run; data data; set data; house_type=.; if m02m_typlog=1 then house_type=1; if m02m_typlog=2 then house_type=2; if m02m_typlog in(3,4,5,6,7,8) then house_type=3; %macro test; %do i=3 %to 10; if m02p_typlog=1 & house_type=. & m02p_lientyp_&i=2 then house_type=1; if m02p_typlog=2 & house_type=. & m02p_lientyp_&i=2 then house_type=2; if m02p_typlog in(3,4,5,6,7,8) & house_type=. & m02p_lientyp_&i=2 then house_type=3; %end; %mend; %test; label house_type = "type of house where the child lives, 2 months"; format house_type house_type.; run; proc freq data=data; table house_type; run; /*3.31 housing type, 1 year*/ proc format Library=Library.formats; Value house_type1y 1="house" 2="apartment" 3="other"; run; Data data; set data; house_type1y=.; if a01m_typlog=1 then house_type1y=1; if a01m_typlog=2 then house_type1y=2; if a01m_typlog in(3,4,5,6,7,8) then house_type1y=3; %macro test; %do i=3 %to 10; if a01p_typlog=1 & house_type=. & a01p_lientyp_&i=2 then house_type1y=1; if a01p_typlog=2 & house_type=. & a01p_lientyp_&i=2 then house_type1y=2; if a01p_typlog in(3,4,5,6,7,8) & house_type=. & a01p_lientyp_&i=2 then house_type1y=3; %end; %mend; %test; label house_type1y = "type of house where the child lives, 1 year"; format house_type1y house_type1y.; run; proc freq data= data; table house_type1y; run; /*3.32 House ownership, 2 months*/ proc format Library=Library.formats; Value house_ownership 1="owned" 2="rented" 3="publicly subsidised" 4="family member" 5="other"; run; Data data; set data; house_ownership=.; if m02m_stoc in(2,3) then house_ownership=1; if m02m_stoc=1 then house_ownership=2; if m02m_stoc in(4,5,6) then house_ownership=5; if m02m_stoc=5 & m02m_propfam=1 then house_ownership=4; if m02m_stoc in(1,5) & m02m_prophlm=1 then house_ownership=3; %macro test; %do i=3 %to 10; if m02p_stoc in(2,3) & house_ownership=. & m02p_lientyp_&i=2 then house_ownership=1; if m02p_stoc in(1,5) & m02p_prophlm=1 & house_ownership=. & m02p_lientyp_&i=2 then house_ownership=3; if m02p_stoc in(1) & house_ownership=. & m02p_lientyp_&i=2 then house_ownership=2; if m02p_stoc=5 & m02p_propfam=1 & house_ownership=. & m02p_lientyp_&i=2 then house_ownership=4; if m02p_stoc in(4,5,6) & house_ownership=. & m02p_lientyp_&i=2 then house_ownership=5; %end; %mend; %test; if m02m_typlog in(3,4,5,6,7,8) & house_ownership=. then house_ownership=5; %macro test2; %do i=3 %to 10; if m02p_typlog in(3,4,5,6,7,8) & house_ownership=. & m02p_lientyp_&i=2 then house_ownership=5; %end; %mend; %test2; label house_ownership="housing ownership status, 2 months"; format house_ownership house_ownership.; run; proc freq data=data; table house_ownership; run; /*3.33 house ownership, 1 year*/ proc format Library=Library.formats; Value house_ownership1y 1="owned" 2="rented" 3="publicly subsidised" 4="family member" 5="other"; run; data data; set data; house_ownership1y=.; if a01m_stoc in(2,3) then house_ownership1y=1; if a01m_stoc in (1) then house_ownership1y=2; if a01m_stoc in(4,5,6) then house_ownership1y=5; if a01m_stoc=5 & a01m_propfam=1 then house_ownership1y=4; if a01m_stoc in(1,5) & a01m_prophlm=1 then house_ownership1y=3; %macro test; %do i=3 %to 10; if a01p_stoc in (2,3) & house_ownership1y=. & a01p_lientyp_&i=2 then house_ownership1y=1; if a01p_stoc in(1,5) & a01p_prophlm=1 & house_ownership1y=. & a01p_lientyp_&i=2 then house_ownership1y=3; if a01p_stoc in(1) & house_ownership1y=. & a01p_lientyp_&i=2 then house_ownership1y=2; if a01p_stoc=5 & a01p_propfam=1 & house_ownership1y=. & a01p_lientyp_&i=2 then house_ownership1y=4; if a01p_stoc in(4,5,6) & house_ownership1y=. & a01p_lientyp_&i=2 then house_ownership1y=5; %end; %mend; %test; if a01m_typlog in(3,4,5,6,7,8) & house_ownership1y=. then house_ownership1y=5; %macro test2; %do i=3 %to 10; if a01p_typlog in(3,4,5,6,7,8) & house_ownership1y=. & a01p_lientyp_&i=2 then house_ownership1y=5; %end; %mend; %test2; label house_ownership1y = "housing ownership status, 1 year"; format house_ownership1y house_ownership1y.; run; proc freq data= data; table house_ownership1y; run; /*******************************4. MIGRATION************************************/ /*4.1. Mother born in France*/ proc format Library=Library.formats; Value mbirthfr 1="yes" 0="no"; run; data data; set data; if m02m_lnais_3=1 then mbirthfr = 1; /*born in france*/ if m02m_lnais_3=2 then mbirthfr = 0; /*born abroad*/ if a01m_lnais_3=1 then mbirthfr = 1; /*born in france*/ if a01m_lnais_3=2 then mbirthfr = 0; /*born abroad*/ %macro test; %do i=5 %to 10; if m02p_lnais_&i=1 & m02p_lientyp_&i=2 & mbirthfr=. then mbirthfr = 1; if m02p_lnais_&i=2 & m02p_lientyp_&i=2 & mbirthfr=. then mbirthfr = 0; %end; %mend; %test; %macro test2; %do i=3 %to 10; if a01p_lnais_&i=1 & a01p_lientyp_&i=2 & mbirthfr=. then mbirthfr = 1; if a01p_lnais_&i=2 & a01p_lientyp_&i=2 & mbirthfr=. then mbirthfr = 0; %end; %mend; %test2; if m00m2_lieunaism=1 & mbirthfr=. then mbirthfr = 1; if m00m2_lieunaism=2 & mbirthfr=. then mbirthfr = 0; label mbirthfr = "mother born in france"; format mbirthfr mbirthfr.; run; proc freq data=data; table mbirthfr; run; /*4.2. Mother french nationality at birth*/ proc format Library=Library.formats; Value mnationfr 1="yes" 0="no"; run; data data; set data; if m02m_natio1n_3=1 then mnationfr = 1; /*born with french nationality*/ if m02m_natio1n_3 in(2,3,4) then mnationfr = 0; /*not born with french nationality*/ if a01m_natio1n_3=1 then mnationfr = 1; /*born with french nationality*/ if a01m_natio1n_3 in(2,3,4) then mnationfr = 0; /*not born with french nationality*/ %macro test; %do i=5 %to 10; if m02p_natio1n_&i=1 & m02p_lientyp_&i=2 & mnationfr=. then mnationfr = 1; if m02p_natio1n_&i in (2,3,4) & m02p_lientyp_&i=2 & mnationfr=. then mnationfr = 0; %end; %mend; %test %macro test2; %do i=3 %to 10; if a01p_natio1n_&i=1 & a01p_lientyp_&i=2 & mnationfr=. then mnationfr = 1; if a01p_natio1n_&i in (2,3,4) & a01p_lientyp_&i=2 & mnationfr=. then mnationfr = 0; %end; %mend; %test2; if m00m2_natiom=1 & mnationfr=. then mnationfr = 1; if m00m2_natiom in(2,3,4) & mnationfr=. then mnationfr = 0; label mnationfr = "mother french nationality at birth"; format mnationfr mnationfr.; run; proc freq data=data; table mnationfr; run; /*4.3. Father born in France*/ proc format Library=Library.formats; Value fbirthfr 1="yes" 0="no"; run; data data; set data; if m02p_lnais_4=1 & m02p_lientyp_4=1 then fbirthfr = 1; if m02p_lnais_4=2 & m02p_lientyp_4=1 then fbirthfr = 0; %macro test; %do i=4 %to 10; if a01p_lnais_&i=1 & a01p_lientyp_&i=1 then fbirthfr = 1; if a01p_lnais_&i=2 & a01p_lientyp_&i=1 then fbirthfr = 0; %end; %mend; %test; if m02m_lnais_4=1 & m02m_lientyp_4=1 & fbirthfr=. then fbirthfr = 1; if m02m_lnais_4=2 & m02m_lientyp_4=1 & fbirthfr=. then fbirthfr = 0; %macro test2; %do i=4 %to 10; if a01m_lnais_&i=1 & a01m_lientyp_&i=1 & fbirthfr=. then fbirthfr = 1; if a01m_lnais_&i=2 & a01m_lientyp_&i=1 & fbirthfr=. then fbirthfr = 0; %end; %mend; %test2; if m00m2_lieunaisp=1 & fbirthfr=. then fbirthfr = 1; if m00m2_lieunaisp=2 & fbirthfr=. then fbirthfr = 0; label fbirthfr = "father born in france"; format fbirthfr fbirthfr.; run; proc freq data=data; table fbirthfr; run; /*4.5. Father french nationality at birth*/ proc format Library=Library.formats; Value fnationfr 1="yes" 0="no"; run; data data; set data; if m02p_natio1n_4=1 & m02p_lientyp_4=1 then fnationfr = 1; /*born french nationality*/ if m02p_natio1n_4 in(2,3,4) & m02p_lientyp_4=1 then fnationfr = 0; %macro test; %do i=4 %to 10; if a01p_natio1n_&i=1 & a01p_lientyp_&i=1 then fnationfr = 1; /*born french nationality*/ if a01p_natio1n_&i in(2,3,4) & a01p_lientyp_&i=1 then fnationfr = 0; %end; %mend; %test; if m02m_natio1n_4=1 & m02m_lientyp_4=1 & fnationfr=. then fnationfr = 1; if m02m_natio1n_4 in(2,3,4) & m02m_lientyp_4=1 & fnationfr=. then fnationfr = 0; %macro test2; %do i=4 %to 10; if a01m_natio1n_&i=1 & a01m_lientyp_&i=1 & fnationfr=. then fnationfr = 1; if a01m_natio1n_&i in(2,3,4) & a01m_lientyp_&i=1 & fnationfr=. then fnationfr = 0; %end; %mend; %test2; if m00m2_natiop=1 & fnationfr=. then fnationfr = 1; if m00m2_natiop in (2,3) & fnationfr=. then fnationfr = 0; label fnationfr = "father french nationality at birth"; format fnationfr fnationfr.; run; proc freq data=data; table fnationfr; run; /*4.6. Grandmother born in France (mother)*/ proc format Library=Library.formats; Value m_gmbirthfr 1="yes" 0="no"; run; data data; set data; if m02m_mblieu=1 then m_gmbirthfr = 1; if m02m_mblieu=2 then m_gmbirthfr = 0; %macro test; %do i=4 %to 10; if m02m_lnais_&i=1 & m02m_lientyp_&i=8 & m02m_sexec1_&i=2 & m_gmbirthfr=. then m_gmbirthfr = 1; /*grandparent (mother), female, born in france*/ if m02m_lnais_&i=2 & m02m_lientyp_&i=8 & m02m_sexec1_&i=2 & m_gmbirthfr=. then m_gmbirthfr = 0; %end; %mend; %test; %macro test2; %do i=4 %to 10; if a01m_lnais_&i=1 & a01m_lientyp_&i=8 & a01m_sexe_&i=2 & m_gmbirthfr=. then m_gmbirthfr = 1; /*grandparent (mother), female, born in france*/ if a01m_lnais_&i=2 & a01m_lientyp_&i=8 & a01m_sexe_&i=2 & m_gmbirthfr=. then m_gmbirthfr = 0; %end; %mend; %test2; if m02p_bmlieu=1 & m_gmbirthfr=. then m_gmbirthfr = 1; if m02p_bmlieu=2 & m_gmbirthfr=. then m_gmbirthfr = 0; %macro test3; %do i=5 %to 9; if m02p_lnais_&i=1 & m02p_lientyp_&i=8 & m02p_sexec1_&i=2 & m_gmbirthfr=. then m_gmbirthfr = 1; /*grandparent (mother), female, born in france*/ if m02p_lnais_&i=2 & m02p_lientyp_&i=8 & m02p_sexec1_&i=2 & m_gmbirthfr=. then m_gmbirthfr = 0; %end; %mend; %test3; %macro test4; %do i=4 %to 9; if a01p_lnais_&i=1 & a01p_lientyp_&i=8 & a01p_sexe_&i=2 & m_gmbirthfr=. then m_gmbirthfr = 1; /*grandparent (mother), female, born in france*/ if a01p_lnais_&i=2 & a01p_lientyp_&i=8 & a01p_sexe_&i=2 & m_gmbirthfr=. then m_gmbirthfr = 0; %end; %mend; %test4; label m_gmbirthfr = "grandmother born in france (mother)"; format m_gmbirthfr m_gmbirthfr.; run; proc freq data=data; table m_gmbirthfr; run; /*4.7. Grandmother french nationality at birth (mother)*/ proc format Library=Library.formats; Value m_gmnationfr 1="yes" 0="no"; run; data data; set data; if m02m_mbfranc=1 then m_gmnationfr = 1; if m02m_mbfranc in(2,3,4) then m_gmnationfr = 0; %macro test; %do i=4 %to 10; if m02m_natio1n_&i=1 & m02m_lientyp_&i=8 & m02m_sexec1_&i=2 & m_gmnationfr=. then m_gmnationfr = 1; /*grandparent (mother), female french nationality at birth*/ if m02m_natio1n_&i in(2,3,4) & m02m_lientyp_&i=8 & m02m_sexec1_&i=2 & m_gmnationfr=. then m_gmnationfr = 0; %end; %mend; %test; %macro test2; %do i=4 %to 10; if a01m_natio1n_&i=1 & a01m_lientyp_&i=8 & a01m_sexe_&i=2 & m_gmnationfr=. then m_gmnationfr = 1; /*grandparent (mother), female french nationality at birth*/ if a01m_natio1n_&i in(2,3,4) & a01m_lientyp_&i=8 & a01m_sexe_&i=2 & m_gmnationfr=. then m_gmnationfr = 0; %end; %mend; %test2; if m02p_bmfranc=1 & m_gmnationfr=. then m_gmnationfr = 1; if m02p_bmfranc in(2,3,4) & m_gmnationfr=. then m_gmnationfr = 0; %macro test3; %do i=5 %to 9; if m02p_natio1n_&i=1 & m02p_lientyp_&i=8 & m02p_sexec1_&i=2 & m_gmnationfr=. then m_gmnationfr = 1; /*grandparent (mother), female french nationality at birth*/ if m02p_natio1n_&i in (2,3,4) & m02p_lientyp_&i=8 & m02p_sexec1_&i=2 & m_gmnationfr=. then m_gmnationfr = 0; %end; %mend; %test3; %macro test4; %do i=4 %to 9; if a01p_natio1n_&i=1 & a01p_lientyp_&i=8 & a01p_sexe_&i=2 & m_gmnationfr=. then m_gmnationfr = 1; /*grandparent (mother), female french nationality at birth*/ if a01p_natio1n_&i in(2,3,4) & a01p_lientyp_&i=8 & a01p_sexe_&i=2 & m_gmnationfr=. then m_gmnationfr = 0; %end; %mend; %test4; label m_gmnationfr = "grandmother french nationality at birth (mother)"; format m_gmnationfr m_gmnationfr.; run; proc freq data=data; table m_gmnationfr; run; /*4.8. Grandfather born in France (mother)*/ proc format Library=Library.formats; Value m_gfbirthfr 1="yes" 0="no"; run; data data; set data; if m02m_pblieu=1 then m_gfbirthfr = 1; if m02m_pblieu=2 then m_gfbirthfr = 0; %macro test; %do i=4 %to 10; if m02m_lnais_&i=1 & m02m_lientyp_&i=8 & m02m_sexec1_&i=1 & m_gfbirthfr=. then m_gfbirthfr = 1; /*grandparent (mother), male, born in france*/ if m02m_lnais_&i=2 & m02m_lientyp_&i=8 & m02m_sexec1_&i=1 & m_gfbirthfr=. then m_gfbirthfr = 0; %end; %mend; %test; %macro test2; %do i=4 %to 10; if a01m_lnais_&i=1 & a01m_lientyp_&i=8 & a01m_sexe_&i=1 & m_gfbirthfr=. then m_gfbirthfr = 1; /*grandparent (mother), male, born in france*/ if a01m_lnais_&i=2 & a01m_lientyp_&i=8 & a01m_sexe_&i=1 & m_gfbirthfr=. then m_gfbirthfr = 0; %end; %mend; %test2; if m02p_bplieu=1 & m_gfbirthfr=. then m_gfbirthfr = 1; if m02p_bplieu=2 & m_gfbirthfr=. then m_gfbirthfr = 0; %macro test3; %do i=5 %to 9; if m02p_lnais_&i=1 & m02p_lientyp_&i=8 & m02p_sexec1_&i=1 & m_gfbirthfr=. then m_gfbirthfr = 1; /*grandparent (mother), male, born in france*/ if m02p_lnais_&i=2 & m02p_lientyp_&i=8 & m02p_sexec1_&i=1 & m_gfbirthfr=. then m_gfbirthfr = 0; %end; %mend; %test3; %macro test4; %do i=4 %to 9; if a01p_lnais_&i=1 & a01p_lientyp_&i=8 & a01p_sexe_&i=1 & m_gfbirthfr=. then m_gfbirthfr = 1; /*grandparent (mother), male, born in france*/ if a01p_lnais_&i=2 & a01p_lientyp_&i=8 & a01p_sexe_&i=1 & m_gfbirthfr=. then m_gfbirthfr = 0; %end; %mend; %test4; label m_gfbirthfr = "grandfather born in france (mother)"; format m_gfbirthfr m_gfbirthfr.; run; proc freq data=data; table m_gfbirthfr; run; /*4.9. Grandfather french nationality at birth (mother)*/ proc format Library=Library.formats; Value m_gfnationfr 1="yes" 0="no"; run; data data; set data; if m02m_pbfranc=1 then m_gfnationfr = 1; if m02m_pbfranc in(2,3,4) then m_gfnationfr = 0; %macro test; %do i=4 %to 10; if m02m_natio1n_&i=1 & m02m_lientyp_&i=8 & m02m_sexec1_&i=1 & m_gfnationfr=. then m_gfnationfr = 1 ; /*grandparent (mother), male french nationality at birth */ if m02m_natio1n_&i in (2,3,4) & m02m_lientyp_&i=8 & m02m_sexec1_&i=1 & m_gfnationfr=. then m_gfnationfr = 0; %end; %mend; %test; %macro test2; %do i=4 %to 10; if a01m_natio1n_&i=1 & a01m_lientyp_&i=8 & a01m_sexe_&i=1 & m_gfnationfr=. then m_gfnationfr = 1; /*grandparent (mother), male french nationality at birth*/ if a01m_natio1n_&i in(2,3,4) & a01m_lientyp_&i=8 & a01m_sexe_&i=1 & m_gfnationfr=. then m_gfnationfr = 0; %end; %mend; %test2; if m02p_bpfranc=1 & m_gfnationfr=. then m_gfnationfr = 1; if m02p_bpfranc in(2,3,4) & m_gfnationfr=. then m_gfnationfr = 0; %macro test3; %do i=5 %to 9; if m02p_natio1n_&i=1 & m02p_lientyp_&i=8 & m02p_sexec1_&i=1 & m_gfnationfr=. then m_gfnationfr = 1; /*grandparent (mother), male french nationality at birth*/ if m02p_natio1n_&i in (2,3,4) & m02p_lientyp_&i=8 & m02p_sexec1_&i=1 & m_gfnationfr=. then m_gfnationfr = 0; %end; %mend; %test3; %macro test4; %do i=4 %to 9; if a01p_natio1n_&i=1 & a01p_lientyp_&i=8 & a01p_sexe_&i=1 & m_gfnationfr=. then m_gfnationfr = 1; /*grandparent (mother), male french nationality at birth*/ if a01p_natio1n_&i in(2,3,4) & a01p_lientyp_&i=8 & a01p_sexe_&i=1 & m_gfnationfr=. then m_gfnationfr = 0; %end; %mend; %test4; label m_gfnationfr = "grandfather french nationality at birth (mother)"; format m_gfnationfr m_gfnationfr.; run; proc freq data=data; table m_gfnationfr; run; /*4.10. grandmother born in france (father)*/ proc format Library=Library.formats; Value f_gmbirthfr 1="yes" 0="no"; run; data data; set data; if m02p_mblieu=1 then f_gmbirthfr = 1; if m02p_mblieu=2 then f_gmbirthfr = 0; %macro test; %do i=5 %to 11; if m02p_lnais_&i=1 & m02p_lientyp_&i=9 & m02p_sexec1_&i=2 & f_gmbirthfr=. then f_gmbirthfr = 1; /*grandparent (father), female, born in france*/ if m02p_lnais_&i=2 & m02p_lientyp_&i=9 & m02p_sexec1_&i=2 & f_gmbirthfr=. then f_gmbirthfr = 0; %end; %mend; %test; %macro test2; %do i=5 %to 10; if a01p_lnais_&i=1 & a01p_lientyp_&i=9 & a01p_sexe_&i=2 & f_gmbirthfr=. then f_gmbirthfr = 1; /*grandparent (father), female, born in france*/ if a01p_lnais_&i=2 & a01p_lientyp_&i=9 & a01p_sexe_&i=2 & f_gmbirthfr=. then f_gmbirthfr = 0; %end; %mend; %test2; if m02m_bmlieu=1 & f_gmbirthfr=. then f_gmbirthfr = 1; if m02m_bmlieu=2 & f_gmbirthfr=. then f_gmbirthfr = 0; %macro test3; %do i=4 %to 10; if m02m_lnais_&i=1 & m02m_lientyp_&i=9 & m02m_sexec1_&i=2 & f_gmbirthfr=. then f_gmbirthfr = 1; /*grandparent (father), female, born in france*/ if m02m_lnais_&i=2 & m02m_lientyp_&i=9 & m02m_sexec1_&i=2 & f_gmbirthfr=. then f_gmbirthfr = 0; %end; %mend; %test3; %macro test4; %do i=4 %to 10; if a01m_lnais_&i=1 & a01m_lientyp_&i=9 & a01m_sexe_&i=2 & f_gmbirthfr=. then f_gmbirthfr = 1; /*grandparent (father), female, born in france*/ if a01m_lnais_&i=2 & a01m_lientyp_&i=9 & a01m_sexe_&i=2 & f_gmbirthfr=. then f_gmbirthfr = 0; %end; %mend; %test4; label f_gmbirthfr = "grandmother born in france (father)"; format f_gmbirthfr f_gmbirthfr.; run; proc freq data=data; table f_gmbirthfr; run; /*4.11. grandmother french nationality at birth (father)*/ proc format Library=Library.formats; Value f_gmnationfr 1="yes" 0="no"; run; data data; set data; if m02p_mbfranc=1 then f_gmnationfr = 1 ; if m02p_mbfranc in(2,3,4) then f_gmnationfr = 0; %macro test; %do i=5 %to 11; if m02p_natio1n_&i=1 & m02p_lientyp_&i=9 & m02p_sexec1_&i=2 & f_gmnationfr=. then f_gmnationfr = 1; /*grandparent (mother), female french nationality at birth*/ if m02p_natio1n_&i in(2,3,4) & m02p_lientyp_&i=9 & m02p_sexec1_&i=2 & f_gmnationfr=. then f_gmnationfr = 0; %end; %mend; %test %macro test2; %do i=5 %to 10; if a01p_natio1n_&i=1 & a01p_lientyp_&i=9 & a01p_sexe_&i=2 & f_gmnationfr=. then f_gmnationfr = 1; /*grandparent (mother), female french nationality at birth*/ if a01p_natio1n_&i in(2,3,4) & a01p_lientyp_&i=9 & a01p_sexe_&i=2 & f_gmnationfr=. then f_gmnationfr = 0; %end; %mend; %test2; if m02m_bmfranc=1 & f_gmnationfr=. then f_gmnationfr = 1; if m02m_bmfranc in(2,3,4) & f_gmnationfr=. then f_gmnationfr = 0; %macro test3; %do i=4 %to 10; if m02m_natio1n_&i=1 & m02m_lientyp_&i=9 & m02m_sexec1_&i=2 & f_gmnationfr=. then f_gmnationfr = 1; /*grandparent (mother), female french nationality at birth*/ if m02m_natio1n_&i in(2,3,4) & m02m_lientyp_&i=9 & m02m_sexec1_&i=2 & f_gmnationfr=. then f_gmnationfr = 0; %end; %mend; %test3; %macro test4; %do i=4 %to 10; if a01m_natio1n_&i=1 & a01m_lientyp_&i=9 & a01m_sexe_&i=2 & f_gmnationfr=. then f_gmnationfr = 1; /*grandparent (mother), female french nationality at birth*/ if a01m_natio1n_&i in(2,3,4) & a01m_lientyp_&i=9 & a01m_sexe_&i=2 & f_gmnationfr=. then f_gmnationfr = 0; %end; %mend; %test4; label f_gmnationfr = "grandmother french nationality at birth (father)"; format f_gmnationfr f_gmnationfr.; run; proc freq data=data; table f_gmnationfr; run; /*4.12. grandfather born in france (father)*/ proc format Library=Library.formats; Value f_gfbirthfr 1="yes" 0="no"; run; data data; set data; if m02p_pblieu=1 then f_gfbirthfr = 1; if m02p_pblieu=2 then f_gfbirthfr = 0; %macro test; %do i=5 %to 10; if m02p_lnais_&i=1 & m02p_lientyp_&i=9 & m02p_sexec1_&i=1 & f_gfbirthfr=. then f_gfbirthfr = 1; /*grandparent (father), male, born in france*/ if m02p_lnais_&i=2 & m02p_lientyp_&i=9 & m02p_sexec1_&i=1 & f_gfbirthfr=. then f_gfbirthfr = 0; %end; %mend; %test; %macro test2; %do i=5 %to 10; if a01p_lnais_&i=1 & a01p_lientyp_&i=9 & a01p_sexe_&i=1 & f_gfbirthfr=. then f_gfbirthfr = 1; /*grandparent (father), male, born in france*/ if a01p_lnais_&i=2 & a01p_lientyp_&i=9 & a01p_sexe_&i=1 & f_gfbirthfr=. then f_gfbirthfr = 0; %end; %mend; %test2; if m02m_bplieu=1 & f_gfbirthfr=. then f_gfbirthfr = 1; if m02m_bplieu=2 & f_gfbirthfr=. then f_gfbirthfr = 0; %macro test3; %do i=4 %to 10; if m02m_lnais_&i=1 & m02m_lientyp_&i=9 & m02m_sexec1_&i=1 & f_gfbirthfr=. then f_gfbirthfr = 1; /*grandparent (father), male, born in france*/ if m02m_lnais_&i=2 & m02m_lientyp_&i=9 & m02m_sexec1_&i=1 & f_gfbirthfr=. then f_gfbirthfr = 0; %end; %mend; %test3; %macro test4; %do i=4 %to 10; if a01m_lnais_&i=1 & a01m_lientyp_&i=9 & a01m_sexe_&i=1 & f_gfbirthfr=. then f_gfbirthfr = 1; /*grandparent (father), male, born in france*/ if a01m_lnais_&i=2 & a01m_lientyp_&i=9 & a01m_sexe_&i=1 & f_gfbirthfr=. then f_gfbirthfr = 0; %end; %mend; %test4; label f_gfbirthfr = "grandfather born in france (father)"; format f_gfbirthfr f_gfbirthfr.; run; proc freq data=data; table f_gfbirthfr; run; /*4.13. grandfather french nationality at birth (father)*/ proc format Library=Library.formats; Value f_gfnationfr 1="yes" 0="no"; run; data data; set data; if m02p_pbfranc=1 then f_gfnationfr = 1 ; if m02p_pbfranc in (2,3,4) then f_gfnationfr = 0; %macro test; %do i=5 %to 11; if m02p_natio1n_&i=1 & m02p_lientyp_&i=9 & m02p_sexec1_&i=1 & f_gfnationfr=. then f_gfnationfr = 1; /*grandparent (father), male french nationality at birth*/ if m02p_natio1n_&i in(2,3,4) & m02p_lientyp_&i=9 & m02p_sexec1_&i=1 & f_gfnationfr=. then f_gfnationfr = 0 ; %end; %mend; %test; %macro test2; %do i=5 %to 10; if a01p_natio1n_&i=1 & a01p_lientyp_&i=9 & a01p_sexe_&i=1 & f_gfnationfr=. then f_gfnationfr = 1; /*grandparent (father), male french nationality at birth*/ if a01p_natio1n_&i in(2,3,4) & a01p_lientyp_&i=9 & a01p_sexe_&i=1 & f_gfnationfr=. then f_gfnationfr = 0; %end; %mend; %test2; if m02m_bpfranc=1 & f_gfnationfr=. then f_gfnationfr = 1; if m02m_bpfranc in(2,3,4) & f_gfnationfr=. then f_gfnationfr = 0; %macro test3; %do i=4 %to 10; if m02m_natio1n_&i=1 & m02m_lientyp_&i=9 & m02m_sexec1_&i=1 & f_gfnationfr=. then f_gfnationfr = 1; /*grandparent (father), male french nationality at birth*/ if m02m_natio1n_&i in(2,3,4) & m02m_lientyp_&i=9 & m02m_sexec1_&i=1 & f_gfnationfr=. then f_gfnationfr = 0; %end; %mend; %test3; %macro test4; %do i=4 %to 10; if a01m_natio1n_&i=1 & a01m_lientyp_&i=9 & a01m_sexe_&i=1 & f_gfnationfr=. then f_gfnationfr = 1; /*grandparent (father), male french nationality at birth*/ if a01m_natio1n_&i in(2,3,4) & a01m_lientyp_&i=9 & a01m_sexe_&i=1 & f_gfnationfr=. then f_gfnationfr = 0; %end; %mend; %test4; label f_gfnationfr = "grandfather french nationality at birth (father)"; format f_gfnationfr f_gfnationfr.; run; proc freq data=data; table f_gfnationfr; run; /*4.14. father's language*/ proc format Library=Library.formats; Value fleng 1="french" 0="foreign lenguage" 2="not clear"; run; proc format Library=Library.formats; Value flenghome 1="french" 0="other"; run; proc format Library=Library.formats; Value flengent 1="french" 0="other"; run; data data; set data; if m02p_lang1e=2 then flenghome = 1; /*language spoken at home with the child*/ if flenghome=. & m02p_lang1e ^=. then flenghome = 0; if a01p_lang1e=2 & flenghome=. then flenghome = 1; if flenghome=. & a01p_lang1e^=. then flenghome = 0; label flenghome = "lenguage spoken at home with the child, father"; if m02p_lang=1 then flengent = 1; /*interview lenguage*/ if flengent=. & m02p_lang ^= . then flengent = 0; if a01p_lang=1 & flengent=. then flengent = 1; /*interview lenguage*/ if flengent=. & a01p_lang ^= . then flengent = 0; label flengent = "lenguage at interview, father"; if flenghome=1 & flengent=1 then fleng = 1; if flenghome=0 & flengent=1 then fleng = 0; /*french origin language*/ if flenghome=0 & flengent=0 then fleng = 0; /*foreign language as origin*/ if flenghome=1 & flengent=0 then fleng = 2; /*french at home but foreign language at interview*/ label fleng = "main lenguage"; format fleng fleng.; format flengent flengent.; format flenghome flenghome.; run; proc freq data=data; table fleng; run; /*4.15. Grandmother's language (father)*/ proc format Library=Library.formats; Value f_gmleng 1="french" 0="other language"; run; data data; set data; if m02p_peremlan=1 then f_gmleng = 1; if f_gmleng=. & m02p_peremlan ^=. then f_gmleng = 0; if m02p_mblang=1 & f_gmleng=. then f_gmleng = 1; if m02p_mblang^=. & f_gmleng=. then f_gmleng = 0; if a01p_peremlan=1 & f_gmleng=. then f_gmleng = 1; if f_gmleng=. & a01p_peremlan^=. then f_gmleng = 0; if m02m_peremlan=1 & f_gmleng=. then f_gmleng = 1; if m02m_peremlan^=. & f_gmleng=. then f_gmleng = 0; if m02m_bmlang=1 & f_gmleng=. & m02m_lientyp_4=1 then f_gmleng = 1; if m02m_bmlang^=. & m02m_bmlang^=1 & m02m_bmlang^=999 & m02m_lientyp_4=1 then f_gmleng = 0; /*not condition*/ /*on missing data, because there are some differences and i tend to trust info on foreign lenguage*/ if a01m_peremlan=1 & f_gmleng=. then f_gmleng = 1; if a01m_peremlan^=. & f_gmleng=. then f_gmleng = 0; label f_gmleng = "main language grandmother"; format f_gmleng f_gmleng.; run; proc freq data=data; table f_gmleng; run; /*4.16. Grandfather's main language (father)*/ proc format Library=Library.formats; Value f_gfleng 1="french" 0="other language"; run; data data; set data; if m02p_pereplan=1 then f_gfleng = 1; if f_gfleng=. & m02p_pereplan^=. then f_gfleng = 0; if m02p_pblang=1 & f_gfleng=. then f_gfleng = 1; if m02p_pblang^=. & f_gfleng=. then f_gfleng = 0; if a01p_pereplan=1 & f_gfleng=. then f_gfleng = 1; if f_gfleng=. & a01p_pereplan^=. then f_gfleng = 0; if m02m_pereplan=1 & f_gfleng=. then f_gfleng = 1; if m02m_pereplan^=. & f_gfleng=. then f_gfleng = 0; if m02m_bplang=1 & f_gfleng=. & m02m_lientyp_4=1 then f_gfleng = 1; if m02m_bplang not in(.,1,999) & m02m_lientyp_4=1 then f_gfleng = 0; /*not condition*/ /*on missing data, because there are some differences and i tend to trust info on foreign lenguage*/ if a01m_pereplan=1 & f_gfleng=. then f_gfleng = 1; if a01m_pereplan ^=. & f_gfleng=. then f_gfleng = 0; label f_gfleng = "main lenguage grandfather father"; format f_gfleng f_gfleng.; run; proc freq data=data; table f_gfleng; run; /*4.17. Mother's language*/ proc format Library=Library.formats; Value mleng 1="french" 0="foreign language" 2="not clear"; run; proc format Library=Library.formats; value mlenghome 1 ="french" 0 ="other"; run; proc format Library=Library.formats; value mlengent 1 ="french" 0 ="other"; run; data data; set data; if m02m_lang1e=2 then mlenghome = 1; /*lenguage spoken at home with the child*/ if mlenghome=. & m02m_lang1e^=. then mlenghome = 0; if a01m_lang1e=2 & mlenghome=. then mlenghome = 1; /*lenguage spoken at home with the child*/ if mlenghome=. & a01m_lang1e^=. then mlenghome = 0; label mlenghome = "language spoken at home with the child, mother"; if m02m_lang=1 then mlengent = 1; /*interview lenguage*/ if mlengent=. & m02m_lang ^=. then mlengent = 0; if a01m_lang=1 & mlengent=. then mlengent = 1; /*interview lenguage*/ if mlengent=. & a01m_lang^=. then mlengent = 0; label mlengent = "language at interview, mother"; if mlenghome=1 & mlengent=1 then mleng = 1; if mlenghome=0 & mlengent=1 then mleng = 0; /*french origin lenguage*/ if mlenghome=0 & mlengent=0 then mleng = 0; /*foreign lenguage as origin*/ if mlenghome=1 & mlengent=0 then mleng = 2; /*french at home but foreign lenguage at interview*/ label mleng = "main language, mother"; format mlenghome mlenghome.; format mlengent mlengent.; format mleng mleng.; run; proc freq data=data; table mleng; run; /*4.18. Grandmother's language (mother) */ proc format Library=Library.formats; Value m_gmleng 1="french" 0="other"; run; data data; set data; if m02m_meremlan=1 then m_gmleng = 1; if m_gmleng=. & m02m_meremlan^=. then m_gmleng = 0; if m02m_mblang=1 & m_gmleng=. then m_gmleng = 1; if m02m_mblang^=. & m_gmleng=. then m_gmleng = 0; if a01m_meremlan=1 & m_gmleng=. then m_gmleng = 1; if m_gmleng=. & a01m_meremlan ^=. then m_gmleng = 0; if m02p_meremlan=1 & m_gmleng=. then m_gmleng = 1; if m02p_meremlan^=. & m_gmleng=. then m_gmleng = 0; if m02p_bmlang=1 & m_gmleng=. & m02p_lientyp_4=1 then m_gmleng = 1; if m02p_bmlang ^=. & m02p_bmlang^=1 & m02p_bmlang^=999 & m02p_lientyp_4=1 then m_gmleng = 0; /*not condition*/ /*on missing data, because there are some differences and i tend to trust info on foreign lenguage*/ if a01p_meremlan=1 & m_gmleng=. then m_gmleng = 1; if a01p_meremlan^=. & m_gmleng=. then m_gmleng = 0; label m_gmleng = "main lenguage grandmother, mother"; format m_gmleng m_gmleng.; run; proc freq data=data; table m_gmleng; run; /*4.19. Grandfather's lenguage (mother)*/ proc format Library=Library.formats; Value m_gfleng 1="french" 0="other"; run; data data; set data; if m02m_mereplan=1 then m_gfleng = 1; if m_gfleng=. & m02m_mereplan^=. then m_gfleng = 0; if m02m_pblang=1 & m_gfleng=. then m_gfleng = 1; if m02m_pblang^=. & m_gfleng=. then m_gfleng = 0; if a01m_mereplan=1 & m_gfleng=. then m_gfleng = 1; if m_gfleng=. & a01m_mereplan^=. then m_gfleng = 0; if m02p_mereplan=1 & m_gfleng=. then m_gfleng = 1; if m02p_mereplan^=. & m_gfleng=. then m_gfleng = 0; if m02p_bplang=1 & m_gfleng=. & m02p_lientyp_4=1 then m_gfleng = 1; if m02p_bplang not in (.,1,999) & m02p_lientyp_4=1 then m_gfleng = 0; /*not condition*/ /*on missing data, because there are some differences and i tend to trust info on foreign lenguage*/ if a01p_mereplan=1 & m_gfleng=. then m_gfleng = 1; if a01p_mereplan^=. & m_gfleng=. then m_gfleng = 0; label m_gfleng = "main lenguage grandfather mother"; format m_gfleng m_gfleng.; run; proc freq data=data; table m_gfleng; run; /*** Country of origin (immigrant mother)*/ proc format Library=Library.formats; Value 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"; run; data data; set data; mctry = m00m2_pays5naism; if mctry =12 then mctry = .; /*if mctry in (11,.) then mctry = m02m_pays25nais_3; */ /*if mctry in(12) then mctry = .; */ if mctry in(11,.) then mctry = a01m_pays25nais_3; if mctry in(12) then mctry = .; label mctry = "Mother's country of origin"; format mctry mctry.; run; proc freq data=data; table mctry; run; /*** Country of origin (immigrant father)*/ proc format Library=Library.formats; Value 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"; run; data data; set data; fctry = m00m2_pays5naisp; if fctry=12 then fctry = .; if m02p_lientyp_4=1 & fctry in(11,.) then fctry = m02p_pays25nais_4; if fctry =12 then fctry = .; /*%macro test; %do i=4 %to 10; if a01p_lientyp_&i=1 & fctry in(11,.) then fctry = a01p_pays25nais_&i; %end; %mend; %test;*/ if fctry=12 then fctry = .; label fctry = "Father's country of origin"; run; proc freq data=data; table fctry; run; /****************************0. IDENTIFICATION VARS ******************************/ /*5.2. Maternity*/ proc format library=Library.formats; value maternity 0 = "no" 1 = "yes"; run; data data; set data; if m00m2_faf=1 then maternity = 1 ; if m00m2_faf in(.,0) then maternity = 0 ; format maternity maternity.; label maternity="The child is included in the maternity wave"; run; proc freq data=data; table maternity; run; /*5.3. 2 months*/ proc format library=Library.formats; value secondmonths 0 = "no" 1 = "yes"; run; data data; set data; if m02x_qmerecomp2m in(1,2) & m02x_typqmere2m in(1,2,3) then months2 = 1; /*completed and partially completed, mother referent*/ if m02x_qpecfcomp2m in(1,2) & m02x_typqpecf2m in(1,2) then months2 = 1; /*completed and partially completed, father referent*/ if m02x_partimere2m=10 & months2=. then months2 = 1 ; if months2=. then months2 = 0; label months2 = "The child is included in the 2months wave"; format months2 secondmonths.; run; proc freq data=data; table months2; run; /*5.4. 1 year*/ proc format library=Library.formats; value firstyear 1="Yes" 0="No"; run; data data; set data; if a01x_qmerecomp1a in(1,2) & a01x_typqmere1a in(1,2,3) then year1=1; /*Completed and partially completed, mother referent*/ if a01x_qpecfcomp1a in(1,2) & a01x_typqpecf1a in(1,2) then year1=1; /*completed and partially completed, father referent*/ if a01x_partimere1a=10 and year1=. then year1 = 1 ; if year1=. then year1 = 0 ; label year1 = "The child is included in the 1 year wave"; format year1 firstyear.; run; proc freq data=data; table year1; run; /** Unknown Father */ proc format Library=Library.formats; Value f_unknown 1="yes" 0="no"; run; data data; set data; /*if father is not in the household, the father did not recognise the child, and he did not answer the questionnaire....*/ if child_hhld=2 & m02p_lientyp_4 ^=1 & father_recogn_child=0 then f_unknown = 1; if m02m_infper in (2,3,4) & f_unknown=. then f_unknown = 1; if f_unknown=. then f_unknown = 0; label f_unknown = "the father is unknown to elfe, 2 months"; format f_unknown f_unknown.; run; proc freq data=data; table f_unknown; run; data Elfe.Input_variables; set data; run; /* Demenagement between 2months - 1year */ proc format library=Library.formats; value demenag 1="Yes" 0="No"; run; data data; set data; if a01m_demenag=1 then demenag = 1; if a01m_demenag=2 then demenag = 0; %macro test; %do i = 4 %to 10 ; if a01p_demenag=1 & a01p_lientyp_&i=2 & demenag=. then demenag = 1; if a01p_demenag=2 & a01p_lientyp_&i=2 & demenag=. then demenag = 0; %end; %mend; %test; label demenag= "The household moved between 2months and 1year"; format demenag demenag; run; proc freq data=data; table demenag; run; /***************The End**************/