***filling information for alle groups use "H:\Documents\Documents\Daten\Beschäftigtenpanel\Beschäftigtenpanel\Stata\Jahr2000_2007_1_Gruppe.dta", clear *** there are people who are unemployed in one subsumple but worked at least one quarter in the whole data ***For those people sex, education and age is filled sort v3 v1 by v3: egen Geschlecht=max(v11) by v3: replace v11=Geschlecht drop Geschlecht by v3: egen MAXBild_Hilfe=max(MAXBild) by v3: replace MAXBild=MAXBild_Hilfe drop MAXBild_Hilfe by v3: gen Alter_2000_2001=v12 if v1<17 by v3: gen Alter_2002_2003=v12 if v1<25 & v1>=17 by v3: gen Alter_2004_2005=v12 if v1<33 & v1>=25 by v3: gen Alter_2006_2007=v12 if v1<=40 & v1>=33 ***case 1: age is known in teh first subsample of 2000_2001 by v3: replace v12=Alter_2000_2001[_n-8] +2 if v12==0 & v1<25 & v1>=17 by v3: replace v12=Alter_2000_2001[_n-16] +4 if v12==0 & v1<33 & v1>=25 by v3: replace v12=Alter_2000_2001[_n-24] +6 if v12==0 & v1<=40 & v1>=33 by v3: replace v12=0 if v12<=6 ***case 2: age is known in teh first subsample of 2002_2003 by v3: replace v12=Alter_2002_2003[_n+8] -2 if v12==0 & v1<17 by v3: replace v12=Alter_2002_2003[_n-8] +2 if v12==0 & v1<33 & v1>=25 by v3: replace v12=Alter_2002_2003[_n-16] +4 if v12==0 & v1<=40 & v1>=33 by v3: replace v12=0 if v12<=6 ***case 3: age is known in teh first subsample of 2004_2005 by v3: replace v12=Alter_2004_2005[_n+16] -4 if v12==0 & v1<17 by v3: replace v12=Alter_2004_2005[_n+8] -2 if v12==0 & v1<25 & v1>=17 by v3: replace v12=Alter_2004_2005[_n-8] +2 if v12==0 & v1<=40 & v1>=33 by v3: replace v12=0 if v12<=6 ***case 4: age is known in teh first subsample of 2006_2007 by v3: replace v12=Alter_2006_2007[_n+24] -6 if v12==0 & v1<17 by v3: replace v12=Alter_2006_2007[_n+16] -4 if v12==0 & v1<25 & v1>=17 by v3: replace v12=Alter_2006_2007[_n+8] -2 if v12==0 & v1<33 & v1>=25 by v3: replace v12=0 if v12<=6 drop Alter_2000_2001 drop Alter_2002_2003 drop Alter_2004_2005 drop Alter_2006_2007 ***save data save "H:\Documents\Documents\Daten\Beschäftigtenpanel\Beschäftigtenpanel\Stata\Jahr2000_2007_1_Gruppe.dta", replace clear ***same procedure for every group use "H:\Documents\Documents\Daten\Beschäftigtenpanel\Beschäftigtenpanel\Stata\Jahr2000_2007_2_Gruppe.dta", clear sort v3 v1 by v3: egen Geschlecht=max(v11) by v3: replace v11=Geschlecht drop Geschlecht by v3: egen MAXBild_Hilfe=max(MAXBild) by v3: replace MAXBild=MAXBild_Hilfe drop MAXBild_Hilfe by v3: gen Alter_2000_2001=v12 if v1<17 by v3: gen Alter_2002_2003=v12 if v1<25 & v1>=17 by v3: gen Alter_2004_2005=v12 if v1<33 & v1>=25 by v3: gen Alter_2006_2007=v12 if v1<=40 & v1>=33 by v3: replace v12=Alter_2000_2001[_n-8] +2 if v12==0 & v1<25 & v1>=17 by v3: replace v12=Alter_2000_2001[_n-16] +4 if v12==0 & v1<33 & v1>=25 by v3: replace v12=Alter_2000_2001[_n-24] +6 if v12==0 & v1<=40 & v1>=33 by v3: replace v12=0 if v12<=6 by v3: replace v12=Alter_2002_2003[_n+8] -2 if v12==0 & v1<17 by v3: replace v12=Alter_2002_2003[_n-8] +2 if v12==0 & v1<33 & v1>=25 by v3: replace v12=Alter_2002_2003[_n-16] +4 if v12==0 & v1<=40 & v1>=33 by v3: replace v12=0 if v12<=6 by v3: replace v12=Alter_2004_2005[_n+16] -4 if v12==0 & v1<17 by v3: replace v12=Alter_2004_2005[_n+8] -2 if v12==0 & v1<25 & v1>=17 by v3: replace v12=Alter_2004_2005[_n-8] +2 if v12==0 & v1<=40 & v1>=33 by v3: replace v12=0 if v12<=6 by v3: replace v12=Alter_2006_2007[_n+24] -6 if v12==0 & v1<17 by v3: replace v12=Alter_2006_2007[_n+16] -4 if v12==0 & v1<25 & v1>=17 by v3: replace v12=Alter_2006_2007[_n+8] -2 if v12==0 & v1<33 & v1>=25 by v3: replace v12=0 if v12<=6 drop Alter_2000_2001 drop Alter_2002_2003 drop Alter_2004_2005 drop Alter_2006_2007 save "H:\Documents\Documents\Daten\Beschäftigtenpanel\Beschäftigtenpanel\Stata\Jahr2000_2007_2_Gruppe.dta", replace clear *** use "H:\Documents\Documents\Daten\Beschäftigtenpanel\Beschäftigtenpanel\Stata\Jahr2000_2007_3_Gruppe.dta", clear sort v3 v1 by v3: egen Geschlecht=max(v11) by v3: replace v11=Geschlecht drop Geschlecht by v3: egen MAXBild_Hilfe=max(MAXBild) by v3: replace MAXBild=MAXBild_Hilfe drop MAXBild_Hilfe by v3: gen Alter_2000_2001=v12 if v1<17 by v3: gen Alter_2002_2003=v12 if v1<25 & v1>=17 by v3: gen Alter_2004_2005=v12 if v1<33 & v1>=25 by v3: gen Alter_2006_2007=v12 if v1<=40 & v1>=33 by v3: replace v12=Alter_2000_2001[_n-8] +2 if v12==0 & v1<25 & v1>=17 by v3: replace v12=Alter_2000_2001[_n-16] +4 if v12==0 & v1<33 & v1>=25 by v3: replace v12=Alter_2000_2001[_n-24] +6 if v12==0 & v1<=40 & v1>=33 by v3: replace v12=0 if v12<=6 by v3: replace v12=Alter_2002_2003[_n+8] -2 if v12==0 & v1<17 by v3: replace v12=Alter_2002_2003[_n-8] +2 if v12==0 & v1<33 & v1>=25 by v3: replace v12=Alter_2002_2003[_n-16] +4 if v12==0 & v1<=40 & v1>=33 by v3: replace v12=0 if v12<=6 by v3: replace v12=Alter_2004_2005[_n+16] -4 if v12==0 & v1<17 by v3: replace v12=Alter_2004_2005[_n+8] -2 if v12==0 & v1<25 & v1>=17 by v3: replace v12=Alter_2004_2005[_n-8] +2 if v12==0 & v1<=40 & v1>=33 by v3: replace v12=0 if v12<=6 by v3: replace v12=Alter_2006_2007[_n+24] -6 if v12==0 & v1<17 by v3: replace v12=Alter_2006_2007[_n+16] -4 if v12==0 & v1<25 & v1>=17 by v3: replace v12=Alter_2006_2007[_n+8] -2 if v12==0 & v1<33 & v1>=25 by v3: replace v12=0 if v12<=6 drop Alter_2000_2001 drop Alter_2002_2003 drop Alter_2004_2005 drop Alter_2006_2007 save "H:\Documents\Documents\Daten\Beschäftigtenpanel\Beschäftigtenpanel\Stata\Jahr2000_2007_3_Gruppe.dta", replace clear *** use "H:\Documents\Documents\Daten\Beschäftigtenpanel\Beschäftigtenpanel\Stata\Jahr2000_2007_4_Gruppe.dta", clear sort v3 v1 by v3: egen Geschlecht=max(v11) by v3: replace v11=Geschlecht drop Geschlecht by v3: egen MAXBild_Hilfe=max(MAXBild) by v3: replace MAXBild=MAXBild_Hilfe drop MAXBild_Hilfe by v3: gen Alter_2000_2001=v12 if v1<17 by v3: gen Alter_2002_2003=v12 if v1<25 & v1>=17 by v3: gen Alter_2004_2005=v12 if v1<33 & v1>=25 by v3: gen Alter_2006_2007=v12 if v1<=40 & v1>=33 by v3: replace v12=Alter_2000_2001[_n-8] +2 if v12==0 & v1<25 & v1>=17 by v3: replace v12=Alter_2000_2001[_n-16] +4 if v12==0 & v1<33 & v1>=25 by v3: replace v12=Alter_2000_2001[_n-24] +6 if v12==0 & v1<=40 & v1>=33 by v3: replace v12=0 if v12<=6 by v3: replace v12=Alter_2002_2003[_n+8] -2 if v12==0 & v1<17 by v3: replace v12=Alter_2002_2003[_n-8] +2 if v12==0 & v1<33 & v1>=25 by v3: replace v12=Alter_2002_2003[_n-16] +4 if v12==0 & v1<=40 & v1>=33 by v3: replace v12=0 if v12<=6 by v3: replace v12=Alter_2004_2005[_n+16] -4 if v12==0 & v1<17 by v3: replace v12=Alter_2004_2005[_n+8] -2 if v12==0 & v1<25 & v1>=17 by v3: replace v12=Alter_2004_2005[_n-8] +2 if v12==0 & v1<=40 & v1>=33 by v3: replace v12=0 if v12<=6 by v3: replace v12=Alter_2006_2007[_n+24] -6 if v12==0 & v1<17 by v3: replace v12=Alter_2006_2007[_n+16] -4 if v12==0 & v1<25 & v1>=17 by v3: replace v12=Alter_2006_2007[_n+8] -2 if v12==0 & v1<33 & v1>=25 by v3: replace v12=0 if v12<=6 drop Alter_2000_2001 drop Alter_2002_2003 drop Alter_2004_2005 drop Alter_2006_2007 save "H:\Documents\Documents\Daten\Beschäftigtenpanel\Beschäftigtenpanel\Stata\Jahr2000_2007_4_Gruppe.dta", replace