* Encoding: UTF-8. /****************************************************************************************************************************************** /* SHP DATA /****************************************************************************************************************************************** /* creation longitudinal file SHP MATCH FILES /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\SHP\Waves_1_19\SPSS\W1_1999\SHP99_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\SHP\Waves_1_19\SPSS\W2_2000\SHP00_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\SHP\Waves_1_19\SPSS\W3_2001\SHP01_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\SHP\Waves_1_19\SPSS\W4_2002\SHP02_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\SHP\Waves_1_19\SPSS\W5_2003\SHP03_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\SHP\Waves_1_19\SPSS\W6_2004\SHP04_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\SHP\Waves_1_19\SPSS\W7_2005\SHP05_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\SHP\Waves_1_19\SPSS\W8_2006\SHP06_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\SHP\Waves_1_19\SPSS\W9_2007\SHP07_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\SHP\Waves_1_19\SPSS\W10_2008\SHP08_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\SHP\Waves_1_19\SPSS\W11_2009\SHP09_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\SHP\Waves_1_19\SPSS\W12_2010\SHP10_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\SHP\Waves_1_19\SPSS\W13_2011\SHP11_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\SHP\Waves_1_19\SPSS\W14_2012\SHP12_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\SHP\Waves_1_19\SPSS\W15_2013\SHP13_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\SHP\Waves_1_19\SPSS\W16_2014\SHP14_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\SHP\Waves_1_19\SPSS\W17_2015\SHP15_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\SHP\Waves_1_19\SPSS\W18_2016\SHP16_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\SHP\Waves_1_19\SPSS\W19_2017\SHP17_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\SHP\Uniques_Files\SPSS\SHP_MP.sav' /BY idpers. exe. compute P99D160 = -3. compute P99D161 = -3. compute P99D162 = -3. compute P99D163 = -3. compute P99D164 = -3. compute P99D165 = -3. compute P00D160 = -3. compute P00D161 = -3. compute P00D162 = -3. compute P00D163 = -3. compute P00D164 = -3. compute P00D165 = -3. compute P01D160 = -3. compute P01D161 = -3. compute P01D162 = -3. compute P01D163 = -3. compute P01D164 = -3. compute P01D165 = -3. compute P02D160 = -3. compute P02D161 = -3. compute P02D162 = -3. compute P02D163 = -3. compute P02D164 = -3. compute P02D165 = -3. compute P03D160 = -3. compute P03D161 = -3. compute P03D162 = -3. compute P03D163 = -3. compute P03D164 = -3. compute P03D165 = -3. /* large file with information about nationality, swiss since birth, date of swiss citizenship, arrival in Switzerland save outFILE='N:\Team-Boris\panel\cohorte_secondos\immigrants.sav' /keep=idpers birthy sex idfath$$ idmoth$$ hab_ch99 hab_ch00 hab_ch01 hab_ch02 hab_ch03 hab_ch04 hab_ch05 hab_ch06 hab_ch07 hab_ch08 hab_ch09 hab_ch10 hab_ch11 hab_ch12 hab_ch13 hab_ch14 hab_ch15 hab_ch16 hab_ch17 nat_1_99 nat_1_00 nat_1_01 nat_1_02 nat_1_03 nat_1_04 nat_1_05 nat_1_06 nat_1_07 nat_1_08 nat_1_09 nat_1_10 nat_1_11 nat_1_12 nat_1_13 nat_1_14 nat_1_15 nat_1_16 nat_1_17 nat_2_99 nat_2_00 nat_2_01 nat_2_02 nat_2_03 nat_2_04 nat_2_05 nat_2_06 nat_2_07 nat_2_08 nat_2_09 nat_2_10 nat_2_11 nat_2_12 nat_2_13 nat_2_14 nat_2_15 nat_2_16 nat_2_17 nat_3_99 nat_3_00 nat_3_01 nat_3_02 nat_3_03 nat_3_04 nat_3_05 nat_3_06 nat_3_07 nat_3_08 nat_3_09 nat_3_10 nat_3_11 nat_3_12 nat_3_13 nat_3_14 nat_3_15 nat_3_16 nat_3_17 P99D160 P00D160 P01D160 P02D160 P03D160 P04D160 P05D160 P06D160 P07D160 P08D160 P09D160 P10D160 P11D160 P12D160 P13D160 P14D160 P15D160 P16D160 P17D160 P99D161 P00D161 P01D161 P02D161 P03D161 P04D161 P05D161 P06D161 P07D161 P08D161 P09D161 P10D161 P11D161 P12D161 P13D161 P14D161 P15D161 P16D161 P17D161 P99D162 P00D162 P01D162 P02D162 P03D162 P04D162 P05D162 P06D162 P07D162 P08D162 P09D162 P10D162 P11D162 P12D162 P13D162 P14D162 P15D162 P16D162 P17D162 P99D163 P00D163 P01D163 P02D163 P03D163 P04D163 P05D163 P06D163 P07D163 P08D163 P09D163 P10D163 P11D163 P12D163 P13D163 P14D163 P15D163 P16D163 P17D163 P99D164 P00D164 P01D164 P02D164 P03D164 P04D164 P05D164 P06D164 P07D164 P08D164 P09D164 P10D164 P11D164 P12D164 P13D164 P14D164 P15D164 P16D164 P17D164 P99D165 P00D165 P01D165 P02D165 P03D165 P04D165 P05D165 P06D165 P07D165 P08D165 P09D165 P10D165 P11D165 P12D165 P13D165 P14D165 P15D165 P16D165 P17D165 status99 status00 status01 status02 status03 status04 status05 status06 status07 status08 status09 status10 status11 status12 status13 status14 status15 status16 status17. get file ='N:\Team-Boris\panel\cohorte_secondos\immigrants.sav'. /* transformation in long file format VARSTOCASES /ID=id /make hab_ch from hab_ch99 to hab_ch17 /make nat_1_ from nat_1_99 to nat_1_17 /make nat_2_ from nat_2_99 to nat_2_17 /make nat_3_ from nat_3_99 to nat_3_17 /make pd160 from p99d160 to p17d160 /make pd161 from p99d161 to p17d161 /make pd162 from p99d162 to p17d162 /make pd163 from p99d163 to p17d163 /make pd164 from p99d164 to p17d164 /make pd165 from p99d165 to p17d165 /make status from status99 to status17 /INDEX=vague(19) /KEEP=IDPERS birthy sex idfath$$ idmoth$$ /NULL=KEEP. var label HAB_CH "Duration of residence in CH: Since when". var label PD160 "Birth in Switzerland". var label PD161 "Swiss since birth". var label PD162 "Reception of Swiss nationality: Year". var label PD163 "Reception of Swiss nationality: Age". var label PD164 "Since when in Switzerland: Year". var label PD165 "Since when in Switzerland: Age". var lab status "Type of interviews completed: grid, proxy, personal". var label HAB_CH "Duration of residence in CH: Since when". val label PD160 -8 "other error" -7 "filter error" -3 "inapplicable" -2 "no answer" -1 "does not know" 1 "yes" 2 "no". val label PD161 -8 "other error" -7 "filter error" -3 "inapplicable" -2 "no answer" -1 "does not know" 1 "yes" 2 "no". val label PD162 -8 "other error" -7 "filter error" -4 "no personal income" -3 "inapplicable" -2 "no answer" -1 "does not know". val label PD163 -8 "other error" -7 "filter error" -4 "no personal income" -3 "inapplicable" -2 "no answer" -1 "does not know". val label PD164 -8 "other error" -7 "filter error" -5 "since birth" -3 "inapplicable" -2 "no answer" -1 "does not know". val label STATUS -8 "other error" -7 "filter error" -3 "inapplicable" -2 "no answer" -1 "does not know" 0 "individual questionnaire" 1 "proxy questionnaire" 2 "grid only" 3 "child care" 4 "biographical questionnaire ". SAVE OUTFILE='N:\Team-Boris\panel\cohorte_secondos\immigrants_long.sav'. /* aggregation of this information for each individual get FILE='N:\Team-Boris\panel\cohorte_secondos\immigrants_long.sav'. recode all (-3=sysmis). miss val all (). if hab_ch=-5 hab_ch=birthy. if pd164=-5 pd164=birthy. exe. aggreg outfile='N:\Team-Boris\panel\cohorte_secondos\immigrants_long_aggr.sav' /break idpers /birthy=first(birthy) /sex=last(sex) /nat_1_=first(nat_1_) /nat_2_=first(nat_2_) /nat_3_=first(nat_3_) /hab_ch=first(hab_ch) /pd160=first(pd160) /pd161=first(pd161) /pd162=first(pd162) /pd163=first(pd163) /pd164=first(pd164) /pd165=first(pd165). get file ='N:\Team-Boris\panel\cohorte_secondos\immigrants_long_aggr.sav' . miss val all (lo thru -1). /* when pd164 is missing, info is taken from hab_ch, issued from grid questionnaire if missing(pd164) and not missing(hab_ch) pd164=hab_ch. fre pd164. compute swiss=0. if nat_1_ = 8100 or nat_2_= 8100 or nat_3_ = 8100 swiss=1. fre swiss. compute arriv=pd164-birthy. compute national=pd162-birthy. var lab arriv "age of arrival in Switzerland". var lab national "age of reception of Swiss citizenship". compute immig=0. if ((swiss=0) or (swiss=1 and pd161=2)) and (pd164-birthy ge 18) immig=1. if (missing(nat_1_) and missing(nat_2_) and missing(nat_3_)) or missing(pd164) immig=999. recode immig (999=sysmis). var lab immig "immigrant: foreign nationality of origin, arrival in Switzerland 18 year or older". fre immig. list idpers nat_1_ nat_2_ nat_3_ swiss pd161 pd162 national pd164 arriv birthy immig. save outfile ='N:\Team-Boris\panel\cohorte_secondos\immigrants_long_aggr2.sav' . /* father's file get file ='N:\Team-Boris\panel\cohorte_secondos\immigrants_long_aggr2.sav' . rename var idpers=IDFATH$$. rename var birthy = birthy_p. rename var sex = sex_p. rename var nat_1_ = nat_1_p. rename var nat_2_ = nat_2_p. rename var nat_3_ = nat_3_p. rename var hab_ch = hab_ch_p. rename var pd160 = pd160_p. rename var pd161 = pd161_p. rename var pd162 = pd162_p. rename var pd163 = pd163_p. rename var pd164 = pd164_p. rename var pd165 = pd165_p. rename var swiss = swiss_p. rename var arriv = arriv_p. rename var national = national_p. rename var immig = immig_p. select if sex_p=1. save outfile ='N:\Team-Boris\panel\cohorte_secondos\immigrants_pere.sav' . /* mother's file get file ='N:\Team-Boris\panel\cohorte_secondos\immigrants_long_aggr2.sav' . rename var idpers=IDMOTH$$. rename var birthy = birthy_m. rename var sex = sex_m. rename var nat_1_ = nat_1_m. rename var nat_2_ = nat_2_m. rename var nat_3_ = nat_3_m. rename var hab_ch = hab_ch_m. rename var pd160 = pd160_m. rename var pd161 = pd161_m. rename var pd162 = pd162_m. rename var pd163 = pd163_m. rename var pd164 = pd164_m. rename var pd165 = pd165_m. rename var swiss = swiss_m. rename var arriv = arriv_m. rename var national = national_m. rename var immig = immig_m. select if sex_m=2. save outfile ='N:\Team-Boris\panel\cohorte_secondos\immigrants_mere.sav' . /* merge of all this information for each individual get FILE='N:\Team-Boris\panel\cohorte_secondos\immigrants_long.sav'. fre vague status. /* selection of the population corresponding to the LIVES cohort - born between 1988 and 1997, scolarized in Switzerland before 10 years old, and individual questionnaire filled select if range(birthy,1988,1997) and (pd164-birthy lt 10) and range(vague,16,19) and status=0. fre status. /* list idpers vague nat_1_ nat_2_ nat_3_ birthy pd164 idfath$$ idmoth$$ immig_p immig_m. fre status. recode status(0=1). aggreg outfile=* /break idpers /nbv=sum(status) /idfath$$=max(idfath$$)/idmoth$$=max(idmoth$$). match files /file=* /table'N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\SHP\Uniques_Files\SPSS\SHP_SO.sav' /BY idpers. exe. match files /file=* /table='N:\Team-Boris\panel\cohorte_secondos\immigrants_long_aggr2.sav' /BY idpers. exe. sort cases by idfath$$. exe. match files /file=* /table='N:\Team-Boris\panel\cohorte_secondos\immigrants_pere.sav' /BY idfath$$. exe. sort cases by idmoth$$. exe. match files /file=* /table='N:\Team-Boris\panel\cohorte_secondos\immigrants_mere.sav' /BY idmoth$$. exe. sort cases by idpers. exe. save outfile ='N:\Team-Boris\panel\cohorte_secondos\immigrants_long_aggr3.sav'. /* file with all information at the individual level, long format get file ='N:\Team-Boris\panel\cohorte_secondos\immigrants_long_aggr3.sav'. /* file with 1845 different cases, representing 5016 annual observations var lab nbv "number of personal interviews during periode 2014-2017". fre nbv. var lab immig_p "father immigrant: foreign nationality of origin, arrival in Switzerland 18 year or older". fre immig_p. var lab immig_m "father immigrant: foreign nationality of origin, arrival in Switzerland 18 year or older". fre immig_m. cross immig_p by immig_m. /* amont those, 81 "secondos" stricto sensus, with both parents immigrated in Switzerland at age 18 or more, without Swiss nationality when they were born if immig_p=1 and immig_m=1 secondos=1. /* Swiss respondent or not compute swiss=0. if nat_1_ = 8100 or nat_2_ = 8100 or nat_3_ = 8100 swiss=1. count rmis=nat_1_ nat_2_ nat_3_ (missing). if rmis=3 swiss=999. var lab rmis "number of missing values - respondents". recode swiss (999=sysmis). var lab swiss "swiss citizenship". val lab swiss 1"yes"0"no". fre swiss. list idpers nat_1_ nat_2_ nat_3_ swiss. fre nat_1_ nat_2_ nat_3_. /* foreign nationality or not compute etra=0. if nat_1_ ne 8100 or nat_2_ ne 8100 or nat_3_ ne 8100 etra=1. if rmis=3 etra=999. recode etra (999=sysmis). var lab etra "foreign citizenship". val lab etra 1"yes"0"no". fre etra. list idpers nat_1_ nat_2_ nat_3_ swiss etra. /* Swiss parents or not fre nat_1_p nat_2_p nat_3_p p$$o20 p$$o23. compute pere_swiss=0. if nat_1_p = 8100 or nat_2_p = 8100 or nat_3_p = 8100 or p$$o20=8100 or p$$o23=8100 pere_swiss=1. count pmis=nat_1_p nat_2_p nat_3_p p$$o20 p$$o23 (missing). if pmis=5 pere_swiss=999. recode pere_swiss (999=sysmis). var lab pmis "number of missing values - fathers". var lab pere_swiss "father with swiss citizenship". val lab pere_swiss 1"yes"0"no". fre pere_swiss. list idpers nat_1_p nat_2_p nat_3_p p$$o20 p$$o23 pere_swiss. compute mere_swiss=0. if nat_1_m = 8100 or nat_2_m = 8100 or nat_3_m = 8100 or p$$o37=8100 or p$$o40=8100 mere_swiss=1. count mmis=nat_1_m nat_2_m nat_3_m p$$o37 p$$o40 (missing). if mmis=5 mere_swiss=999. recode mere_swiss (999=sysmis). var lab mmis "number of missing values - mothers". var lab mere_swiss "mother with swiss citizenship". val lab mere_swiss 1"yes"0"no". fre mere_swiss. list idpers nat_1_m nat_2_m nat_3_m p$$o37 p$$o40 mere_swiss. fre swiss pere_swiss mere_swiss. /*foreign nationality of parents compute pere_etra=0. if nat_1_p ne 8100 or nat_2_p ne 8100 or nat_3_p ne 8100 or p$$o20 ne 8100 or p$$o23 ne 8100 pere_etra=1. if pmis=5 pere_etra=999. recode pere_etra (999=sysmis). var lab pere_etra "father with foreign citizenship". val lab pere_etra 1"yes"0"no". fre pere_etra. list idpers nat_1_p nat_2_p nat_3_p p$$o20 p$$o23 pere_etra. compute mere_etra=0. if nat_1_m ne 8100 or nat_2_m ne 8100 or nat_3_m ne 8100 or p$$o37 ne 8100 or p$$o40 ne 8100 mere_etra=1. if mmis=5 mere_etra=999. recode mere_etra (999=sysmis). var lab mere_etra "mother with foreign citizenship". val lab mere_etra 1"yes"0"no". fre mere_etra. list idpers nat_1_m nat_2_m nat_3_m p$$o37 p$$o40 mere_etra. list idpers swiss etra pere_swiss pere_etra mere_swiss mere_etra immig_p immig_m. /* no migration background fre pd161_p pd161_m immig_p immig_m. miss val pd161_p pd161_m immig_p immig_m (). recode pd161_p pd161_m immig_p immig_m (sysmis=-1). fre pd161_p pd161_m immig_p immig_m. temp. select if etra=0 and pere_etra=0 and mere_etra=0 and pd161_p ne 2 and pd161_m ne 2. fre swiss etra pere_swiss pere_etra mere_swiss mere_etra immig_p immig_m pd161_p pd161_m. list idpers swiss etra pere_swiss pere_etra mere_swiss mere_etra immig_p immig_m. /* definition of respondents without migration background if etra=0 and pere_etra=0 and mere_etra=0 and pd161_p ne 2 and pd161_m ne 2 secondos=3. TEMPORARY. select if secondos=3. fre swiss etra pere_swiss pere_etra mere_swiss mere_etra immig_p immig_m pd161_p pd161_m. fre secondos. /* residual category if missing(secondos) and (pere_etra=1 or mere_etra=1 or etra=1 or pd161_p =2 or pd161_m =2) secondos=2. exe. recode secondos (sysmis=999). var lab secondos "respondent's secondos status". val lab secondos 1"secondos"2"foreign origin"3"no foreign origin"999"not documented". fre secondos. temp. select if secondos=999. list idpers swiss etra pere_swiss pere_etra mere_swiss mere_etra immig_p immig_m pd161_p pd161_m. fre swiss etra pere_swiss pere_etra mere_swiss mere_etra immig_p immig_m pd161_p pd161_m pd164 pd164_p pd164_m. compute survey=1. var lab survey "SHP or LIVES cohort". val lab survey 1"SHP"2"LIVES cohort". save outfile ='N:\Team-Boris\panel\cohorte_secondos\resume_secondos.sav'. /****************************************************************************************************************************************** /* LIVES COHORT DATA /****************************************************************************************************************************************** /* creation longitudinal file LIVES COHORT MATCH FILES /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\LIVES_Cohort\Waves_1_5\SPSS\W1\COHORT13_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\LIVES_Cohort\Waves_1_5\SPSS\W2\COHORT14_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\LIVES_Cohort\Waves_1_5\SPSS\W3\COHORT15_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\LIVES_Cohort\Waves_1_5\SPSS\W4\COHORT16_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\LIVES_Cohort\Waves_1_5\SPSS\W5\COHORT17_P_USER.sav' /FILE='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\LIVES_Cohort\Uniques_files\SPSS\COHORT_MP.sav' /BY idpers. exe. /* large file with information about nationality, swiss since birth, date of swiss citizenship, arrival in Switzerland compute P13d160=-3. compute P13d161=-3. compute P13d162=-3. compute P13d163=-3. compute P13d164=-3. compute P13d165=-3. compute status13 =-3. /* in order to take into account only individual questionnaires during period 2014-2017 (and not biographic restrospective of 2013) save outFILE='N:\Team-Boris\panel\cohorte_secondos\immigrants_COHORT.sav' /keep=idpers birthy sex hab_ch13 hab_ch14 hab_ch15 hab_ch16 hab_ch17 nat_1_13 nat_1_14 nat_1_15 nat_1_16 nat_1_17 nat_2_13 nat_2_14 nat_2_15 nat_2_16 nat_2_17 nat_3_13 nat_3_14 nat_3_15 nat_3_16 nat_3_17 P13D160 P14D160 P15D160 P16D160 P17D160 P13D161 P14D161 P15D161 P16D161 P17D161 P13D162 P14D162 P15D162 P16D162 P17D162 P13D163 P14D163 P15D163 P16D163 P17D163 P13D164 P14D164 P15D164 P16D164 P17D164 P13D165 P14D165 P15D165 P16D165 P17D165 P13D168 P14D168 P15D168 P16D168 P17D168 status13 status14 status15 status16 status17. get file ='N:\Team-Boris\panel\cohorte_secondos\immigrants_COHORT.sav'. /* transformation in long file format VARSTOCASES /ID=id /make hab_ch from hab_ch13 to hab_ch17 /make nat_1_ from nat_1_13 to nat_1_17 /make nat_2_ from nat_2_13 to nat_2_17 /make nat_3_ from nat_3_13 to nat_3_17 /make pd160 from p13d160 to p17d160 /make pd161 from p13d161 to p17d161 /make pd162 from p13d162 to p17d162 /make pd163 from p13d163 to p17d163 /make pd164 from p13d164 to p17d164 /make pd165 from p13d165 to p17d165 /make pd168 from p13d168 to p17d168 /make status from status13 to status17 /INDEX=vague(19) /KEEP=IDPERS birthy sex /NULL=KEEP. var label HAB_CH "Duration of residence in CH: Since when". var label PD160 "Birth in Switzerland". var label PD161 "Swiss since birth". var label PD162 "Reception of Swiss nationality: Year". var label PD163 "Reception of Swiss nationality: Age". var label PD164 "Since when in Switzerland: Year". var label PD165 "Since when in Switzerland: Age". var label PD168 "Secondos: yes-no". var label HAB_CH "Duration of residence in CH: Since when". val label PD160 -8 "other error" -7 "filter error" -3 "inapplicable" -2 "no answer" -1 "does not know" 1 "yes" 2 "no". val label PD161 -8 "other error" -7 "filter error" -3 "inapplicable" -2 "no answer" -1 "does not know" 1 "yes" 2 "no". val label PD162 -8 "other error" -7 "filter error" -4 "no personal income" -3 "inapplicable" -2 "no answer" -1 "does not know". val label PD163 -8 "other error" -7 "filter error" -4 "no personal income" -3 "inapplicable" -2 "no answer" -1 "does not know". val label PD164 -8 "other error" -7 "filter error" -5 "since birth" -3 "inapplicable" -2 "no answer" -1 "does not know". val label PD168 -8 "other error" -7 "filter error" -3 "inapplicable" -2 "no answer" -1 "does not know" 1 "yes" 2 "no". SAVE OUTFILE='N:\Team-Boris\panel\cohorte_secondos\immigrants_COHORT_long.sav'. /* aggregation of this information for each individual get FILE='N:\Team-Boris\panel\cohorte_secondos\immigrants_COHORT_long.sav'. recode all (-3=sysmis). miss val all (). if hab_ch=-5 hab_ch=birthy. if pd164=-5 pd164=birthy. exe. recode status(0=1) (else=0). aggreg outfile='N:\Team-Boris\panel\cohorte_secondos\immigrants_COHORT_long_aggr.sav' /break idpers /birthy=first(birthy) /sex=last(sex) /nat_1_=first(nat_1_) /nat_2_=first(nat_2_) /nat_3_=first(nat_3_) /hab_ch=first(hab_ch) /pd160=first(pd160) /pd161=first(pd161) /pd162=first(pd162) /pd163=first(pd163) /pd164=first(pd164) /pd165=first(pd165) /pd168=first(pd168) /nbv=sum(status). get file ='N:\Team-Boris\panel\cohorte_secondos\immigrants_COHORT_long_aggr.sav' . var lab nbv "number of personal interviews during periode 2014-2017". miss val all (lo thru -1). /* when pd164 is missing, info is taken from hab_ch, issued from grid questionnaire if missing(pd164) and not missing(hab_ch) pd164=hab_ch. fre pd164. compute swiss=0. if nat_1_ = 8100 or nat_2_= 8100 or nat_3_ = 8100 swiss=1. fre swiss. compute arriv=pd164-birthy. compute national=pd162-birthy. var lab arriv "age of arrival in Switzerland". var lab national "age of reception of Swiss citizenship". compute immig=0. if ((swiss=0) or (swiss=1 and pd161=2)) and (pd164-birthy ge 18) immig=1. if (missing(nat_1_) and missing(nat_2_) and missing(nat_3_)) or missing(pd164) immig=999. recode immig (999=sysmis). var lab immig "immigrant: foreign nationality of origin, arrival in Switzerland 18 year or older". fre immig. fre immig. list idpers nat_1_ nat_2_ nat_3_ swiss pd161 pd162 national pd164 arriv birthy immig. save outfile ='N:\Team-Boris\panel\cohorte_secondos\immigrants_COHORT_long_aggr2.sav' . /* add information from Social origin file and construction of the same variables as for the SHP file get file ='N:\Team-Boris\panel\cohorte_secondos\immigrants_COHORT_long_aggr2.sav' . /* select cases with at least one individual questionnaire filled select if nbv gt 0. exe. match files /file=* /table ='N:\SHP-Data-Web-diffusion\Diffusion_FORSbase_2018\LIVES_Cohort\Uniques_files\SPSS\COHORT_SO.sav' /BY idpers. exe. /* file with 1543 different cases, representing 4337 annual observations fre nbv. /* Swiss respondent or not compute swiss=0. if nat_1_ = 8100 or nat_2_ = 8100 or nat_3_ = 8100 swiss=1. count rmis=nat_1_ nat_2_ nat_3_ (missing). if rmis=3 swiss=999. var lab rmis "number of missing values - respondents". recode swiss (999=sysmis). var lab swiss "swiss citizenship". val lab swiss 1"yes"0"no". fre swiss. list idpers nat_1_ nat_2_ nat_3_ swiss. fre nat_1_ nat_2_ nat_3_. /* foreign nationality or not compute etra=0. if nat_1_ ne 8100 or nat_2_ ne 8100 or nat_3_ ne 8100 etra=1. if rmis=3 etra=999. recode etra (999=sysmis). var lab etra "foreign citizenship". val lab etra 1"yes"0"no". fre etra. list idpers nat_1_ nat_2_ nat_3_ swiss etra. /* Swiss parents or not fre p$$o20 p$$o23. compute pere_swiss=0. if p$$o20=8100 or p$$o23=8100 pere_swiss=1. count pmis= p$$o20 p$$o23 (missing). if pmis=2 pere_swiss=999. recode pere_swiss (999=sysmis). var lab pmis "number of missing values - fathers". var lab pere_swiss "father with swiss citizenship". val lab pere_swiss 1"yes"0"no". fre pere_swiss. list idpers p$$o20 p$$o23 pere_swiss. compute mere_swiss=0. if p$$o37=8100 or p$$o40=8100 mere_swiss=1. count mmis= p$$o37 p$$o40 (missing). if mmis=2 mere_swiss=999. recode mere_swiss (999=sysmis). var lab mmis "number of missing values - mothers". var lab mere_swiss "mother with swiss citizenship". val lab mere_swiss 1"yes"0"no". fre mere_swiss. list idpers p$$o37 p$$o40 mere_swiss. fre swiss pere_swiss mere_swiss. /*foreign nationality of parents compute pere_etra=0. if p$$o20 ne 8100 or p$$o23 ne 8100 pere_etra=1. if pmis=2 pere_etra=999. recode pere_etra (999=sysmis). var lab pere_etra "father with foreign citizenship". val lab pere_etra 1"yes"0"no". fre pere_etra. list idpers p$$o20 p$$o23 pere_etra. compute mere_etra=0. if p$$o37 ne 8100 or p$$o40 ne 8100 mere_etra=1. if mmis=2 mere_etra=999. recode mere_etra (999=sysmis). var lab mere_etra "mother with foreign citizenship". val lab mere_etra 1"yes"0"no". fre mere_etra. list idpers p$$o37 p$$o40 mere_etra. list idpers pd168 swiss etra pere_swiss pere_etra mere_swiss mere_etra . fre pd168. recode pd168 (1=1)(else=999) into secondos. fre secondos. /* no migration background /* definition of respondents without migration background if secondos=999 and etra=0 and pere_etra=0 and mere_etra=0 secondos=3. TEMPORARY. select if secondos=3. fre swiss etra pere_swiss pere_etra mere_swiss mere_etra. fre secondos. /* residual category if secondos=999 and (pere_etra=1 or mere_etra=1 or etra=1) secondos=2. var lab secondos "respondent's secondos status". val lab secondos 1"secondos"2"foreign origin"3"no foreign origin". fre secondos pd168. temp. select if missing(secondos). list idpers pd168 swiss etra pere_swiss pere_etra mere_swiss mere_etra . fre swiss etra pere_swiss pere_etra mere_swiss mere_etra pd164. compute survey=2. var lab survey "SHP or LIVES cohort". val lab survey 1"SHP"2"LIVES cohort". save outfile ='N:\Team-Boris\panel\cohorte_secondos\resume_secondos_COHORT.sav'. /* all cases in the same file GET FILE='N:\Team-Boris\panel\cohorte_secondos\resume_secondos.sav'. ADD FILES /FILE=* /FILE='N:\Team-Boris\panel\cohorte_secondos\resume_secondos_COHORT.sav'. EXECUTE. var lab birthy_p 'father - Date of birth: Year'. var lab sex_p 'father - Sex'. var lab nat_1_p 'father - First nationality'. var lab nat_2_p 'father - Second nationality'. var lab nat_3_p 'father - Third nationality'. var lab hab_ch_p 'father - Duration of residence in CH: Since when'. var lab pd160_p 'father - Birth in Switzerland'. var lab pd161_p 'father - Swiss since birth'. var lab pd162_p 'father - Reception of Swiss nationality: Year'. var lab pd163_p 'father - Reception of Swiss nationality: Age'. var lab pd164_p 'father - Since when in Switzerland: Year'. var lab pd165_p 'father - Since when in Switzerland: Age'. var lab swiss_p 'father - swiss nationality_not based on social origin modul'. var lab arriv_p 'father - age of arrival in Switzerland'. var lab national_p 'father - age of reception of Swiss citizenship'. var lab immig_p 'father - father immigrant: foreign nationality of origin, arrival in Switzerland 18 year or older'. var lab birthy_m 'mother - Date of birth: Year'. var lab sex_m 'mother - Sex'. var lab nat_1_m 'mother - First nationality'. var lab nat_2_m 'mother - Second nationality'. var lab nat_3_m 'mother - Third nationality'. var lab hab_ch_m 'mother - Duration of residence in CH: Since when'. var lab pd160_m 'mother - Birth in Switzerland'. var lab pd161_m 'mother - Swiss since birth'. var lab pd162_m 'mother - Reception of Swiss nationality: Year'. var lab pd163_m 'mother - Reception of Swiss nationality: Age'. var lab pd164_m 'mother - Since when in Switzerland: Year'. var lab pd165_m 'mother - Since when in Switzerland: Age'. var lab swiss_m 'mother - swiss nationality_not based on social origin modul'. var lab arriv_m 'mother - age of arrival in Switzerland'. var lab national_m 'mother - age of reception of Swiss citizenship'. var lab immig_m 'mother - father immigrant: foreign nationality of origin, arrival in Switzerland 18 year or older'. save outfile ='N:\Team-Boris\panel\cohorte_secondos\resume_secondos_SHP_COHORT.sav' /drop filter17. get file ='N:\Team-Boris\panel\cohorte_secondos\resume_secondos_SHP_COHORT.sav' . cross secondos pd168 swiss etra pere_swiss pere_etra mere_swiss mere_etra immig_p immig_m pd161 pd161_p pd161_m pd164 pd164_p pd164_m by survey.