use "C:\Users\ecagj\Box Sync\LFS (G.Johnes@lancs.ac.uk)\longitudinal\UKDA-8345-stata11\stata11\fiveq_longitudinal_jm17-jm18_eul_lgwt17.dta" , replace *set survey to number of days since 1/1/60 of survey start g survey=20819 g lgweight=0 *define survey-specific weight replace lgweight=lgwt17 keep Indg07m1 Indg07m* DURUN* SEX AGE1 HIUL15D1 ETUKEUL1 URESMC1 MANAGER1 LIMITK1 lgweight survey append using "C:\Users\ecagj\Box Sync\LFS (G.Johnes@lancs.ac.uk)\longitudinal\UKDA-8328-stata11\stata11\5q_longitudinal_od16-od17_eul_lgwt17.dta" replace survey=20727 if survey==. replace lgweight=lgwt17 if lgweight==. keep Indg07m1 Indg07m* DURUN* SEX AGE1 HIUL15D1 ETUKEUL1 URESMC1 MANAGER1 LIMITK1 lgweight survey append using "C:\Users\ecagj\Box Sync\LFS (G.Johnes@lancs.ac.uk)\longitudinal\UKDA-8310-stata11\stata11\5q_longitudinal_js16-js17_eul_lgwt17.dta" replace survey=20635 if survey==. replace lgweight=lgwt17 if lgweight==. keep Indg07m1 Indg07m* DURUN* SEX AGE1 HIUL15D1 ETUKEUL1 URESMC1 MANAGER1 LIMITK1 lgweight survey append using "C:\Users\ecagj\Box Sync\LFS (G.Johnes@lancs.ac.uk)\longitudinal\UKDA-8237-stata11\stata11\5q_longitudinal_aj16-aj17_eul_lgwt17.dta" replace survey=20544 if survey==. replace lgweight=lgwt17 if lgweight==. keep Indg07m1 Indg07m* DURUN* SEX AGE1 HIUL15D1 ETUKEUL1 URESMC1 MANAGER1 LIMITK1 lgweight survey append using "C:\Users\ecagj\Box Sync\LFS (G.Johnes@lancs.ac.uk)\longitudinal\UKDA-8215-stata11\stata11\five_q_longitudinal_jm16-jm17_eul_lgwt17.dta" replace survey=20454 if survey==. replace lgweight=lgwt17 if lgweight==. keep Indg07m1 Indg07m* DURUN* SEX AGE1 HIUL15D1 ETUKEUL1 URESMC1 MANAGER1 LIMITK1 lgweight survey append using "C:\Users\ecagj\Box Sync\LFS (G.Johnes@lancs.ac.uk)\longitudinal\UKDA-8214-stata11\stata11\five_q_longitudinal_od15-od16_eul_lgwt17.dta" replace survey=20362 if survey==. replace lgweight=lgwt17 if lgweight==. keep Indg07m1 Indg07m* DURUN* SEX AGE1 HIUL15D1 ETUKEUL1 URESMC1 MANAGER1 LIMITK1 lgweight survey append using "C:\Users\ecagj\Box Sync\LFS (G.Johnes@lancs.ac.uk)\longitudinal\UKDA-8107-stata11\stata11\five_q_longitudinal_js15-js16_eul_lgwt17.dta" replace survey=20270 if survey==. replace lgweight=lgwt17 if lgweight==. keep Indg07m1 Indg07m* DURUN* SEX AGE1 HIUL15D1 ETUKEUL1 URESMC1 MANAGER1 LIMITK1 lgweight survey append using "C:\Users\ecagj\Box Sync\LFS (G.Johnes@lancs.ac.uk)\longitudinal\UKDA-8042-stata11\stata11\five_q_longitudinal_aj15-aj16_eul_lgwt17.dta" replace survey=20179 if survey==. replace lgweight=lgwt17 if lgweight==. keep Indg07m1 Indg07m* DURUN* SEX AGE1 HIUL15D1 ETUKEUL1 URESMC1 MANAGER1 LIMITK1 lgweight survey append using "C:\Users\ecagj\Box Sync\LFS (G.Johnes@lancs.ac.uk)\longitudinal\UKDA-7988-stata11\stata11\five_q_longitudinal_jm15-jm16_eul_lgwt17.dta" replace survey=20090 if survey==. replace lgweight=lgwt17 if lgweight==. keep Indg07m1 Indg07m* DURUN* SEX AGE1 HIUL15D1 ETUKEUL1 URESMC1 MANAGER1 LIMITK1 lgweight survey append using "C:\Users\ecagj\Box Sync\LFS (G.Johnes@lancs.ac.uk)\longitudinal\UKDA-7905-stata11\stata11\five_q_longitudinal_od14-od15_eul_lgwt17.dta" replace survey=19998 if survey==. replace lgweight=lgwt17 if lgweight==. keep Indg07m1 HIQUL15D5 Indg07m* DURUN* SEX AGE1 HIUL15D1 ETUKEUL1 URESMC1 MANAGER1 LIMITK1 lgweight survey append using "C:\Users\ecagj\Box Sync\LFS (G.Johnes@lancs.ac.uk)\longitudinal\UKDA-7845-stata11\stata11\five_q_longitudinal_js14-js15_eul_lgwt17.dta" replace survey=19906 if survey==. replace lgweight=lgwt17 if lgweight==. keep Indg07m1 HIQUL15D5 Indg07m* DURUN* SEX AGE1 HIUL15D1 ETUKEUL1 URESMC1 MANAGER1 LIMITK1 lgweight survey append using "C:\Users\ecagj\Box Sync\LFS (G.Johnes@lancs.ac.uk)\longitudinal\UKDA-7790-stata11\stata11\five_q_longitudinal_aj14-aj15_eul_lgwt17.dta" replace survey=19815 if survey==. replace lgweight=lgwt17 if lgweight==. keep Indg07m1 HIQUL15D5 Indg07m* DURUN* SEX AGE1 HIUL15D1 ETUKEUL1 URESMC1 MANAGER1 LIMITK1 lgweight survey append using "C:\Users\ecagj\Box Sync\LFS (G.Johnes@lancs.ac.uk)\longitudinal\UKDA-7729-stata11\stata11\five_q_longitudinal_jm14-jm15_eul_lgwt17.dta" replace survey=19726 if survey==. replace lgweight=lgwt17 if lgweight==. keep Indg07m1 HIQUL15D5 Indg07m* DURUN* SEX AGE1 HIUL15D1 ETUKEUL1 URESMC1 MANAGER1 LIMITK1 lgweight survey append using "C:\Users\ecagj\Box Sync\LFS (G.Johnes@lancs.ac.uk)\longitudinal\UKDA-7681-stata11\stata11\five_q_longitudinal_od13-od14_eul_lgwt17.dta" replace survey=19634 if survey==. replace lgweight=lgwt17 if lgweight==. keep Indg07m1 HIQUL11D4 HIQUL15D5 Indg07m* DURUN* SEX AGE1 HIUL15D1 ETUKEUL1 URESMC1 MANAGER1 LIMITK1 lgweight survey append using "C:\Users\ecagj\Box Sync\LFS (G.Johnes@lancs.ac.uk)\longitudinal\UKDA-7723-stata11\stata11\five_q_longitudinal_js13-js14_eul_lgwt17.dta" replace survey=19542 if survey==. replace lgweight=lgwt17 if lgweight==. keep Indg07m1 HIQUL11D4 HIQUL15D5 Indg07m* DURUN* SEX AGE1 HIUL15D1 ETUKEUL1 URESMC1 MANAGER1 LIMITK1 lgweight survey append using "C:\Users\ecagj\Box Sync\LFS (G.Johnes@lancs.ac.uk)\longitudinal\UKDA-7722-stata11\stata11\five_q_longitudinal_aj13-aj14_eul_lgwt17.dta" replace survey=19451 if survey==. replace lgweight=lgwt17 if lgweight==. keep Indg07m1 HIQUL11D4 HIQUL15D5 Indg07m* DURUN* SEX AGE1 HIUL15D1 ETUKEUL1 URESMC1 MANAGER1 LIMITK1 lgweight survey append using "C:\Users\ecagj\Box Sync\LFS (G.Johnes@lancs.ac.uk)\longitudinal\UKDA-7504-stata11\stata11\five_q_longitudinal_jm13-jm14_eul_lgwt17.dta" replace survey=19362 if survey==. replace lgweight=lgwt17 if lgweight==. keep Indg07m1 HIQUL11D4 HIQUL15D5 Indg07m* DURUN* SEX AGE1 HIUL15D1 ETUKEUL1 URESMC1 MANAGER1 LIMITK1 lgweight survey append using "C:\Users\ecagj\Box Sync\LFS (G.Johnes@lancs.ac.uk)\longitudinal\UKDA-7653-stata11\stata11\five_q_longitudinal_od12-od13_eul_lgwt17.dta" replace survey=19270 if survey==. replace lgweight=LGWT17 if lgweight==. keep Indg07m1 HIQUL11D4 HIQUL15D5 Indg07m* DURUN* SEX AGE1 HIUL15D1 ETUKEUL1 URESMC1 MANAGER1 LIMITK1 lgweight survey append using "C:\Users\ecagj\Box Sync\LFS (G.Johnes@lancs.ac.uk)\longitudinal\UKDA-7652-stata11\stata11\five_q_longitudinal_js12-js13_eul_lgwt17.dta" replace survey=19178 if survey==. replace lgweight=LGWT17 if lgweight==. keep Indg07m1 HIQUL11D4 HIQUL15D5 Indg07m* DURUN* SEX AGE1 HIUL15D1 ETUKEUL1 URESMC1 MANAGER1 LIMITK1 lgweight survey append using "C:\Users\ecagj\Box Sync\LFS (G.Johnes@lancs.ac.uk)\longitudinal\UKDA-7379-stata11\stata11\five_q_longitudinal_aj12-aj13_eul_lgwt17.dta" replace survey=19087 if survey==. replace lgweight=lgwt17 if lgweight==. keep Indg07m1 HIQUL11D4 HIQUL15D5 Indg07m* DURUN* SEX AGE1 HIUL15D1 ETUKEUL1 URESMC1 MANAGER1 LIMITK1 lgweight survey keep if Indg07m1>=470&Indg07m1<480 keep if DURUN2>0|DURUN3>0|DURUN4>0|DURUN5>0|Indg07m2<470|Indg07m2>479|Indg07m3<470|Indg07m3>479|Indg07m4<470|Indg07m4>479|Indg07m5<470|Indg07m5>479 g id=_n g t0=0 replace t0=2 if Indg07m2!=Indg07m1|DURUN2>0 replace t0=3 if (Indg07m3!=Indg07m2|DURUN3>0)&t0==0 replace t0=4 if (Indg07m4!=Indg07m3|DURUN4>0)&t0==0 replace t0=5 if (Indg07m5!=Indg07m4|DURUN5>0)&t0==0 g t1=0 replace t1=2 if Indg07m2!=Indg07m1&Indg07m2>0 replace t1=3 if Indg07m3!=Indg07m2&Indg07m3>0&t1==0 replace t1=4 if Indg07m4!=Indg07m3&Indg07m4>0&t1==0 replace t1=5 if Indg07m5!=Indg07m4&Indg07m5>0&t1==0 replace t1=3 if DURUN2>0&Indg07m3>0 replace t1=4 if DURUN3>0&Indg07m4>0 replace t1=5 if DURUN4>0&Indg07m5>0 replace t1=5 if t1==0 g outcome=0 replace outcome=1 if t1==2&Indg07m2>0&Indg07m2>=470&Indg07m2<480 replace outcome=2 if t1==2&Indg07m2>0&(Indg07m2<470|Indg07m2>=480) replace outcome=1 if t1==3&Indg07m3>0&Indg07m3>=470&Indg07m3<480 replace outcome=2 if t1==3&Indg07m3>0&(Indg07m3<470|Indg07m3>=480) replace outcome=1 if t1==4&Indg07m4>0&Indg07m4>=470&Indg07m4<480 replace outcome=2 if t1==4&Indg07m4>0&(Indg07m4<470|Indg07m4>=480) replace outcome=1 if t1==5&Indg07m5>0&Indg07m5>=470&Indg07m5<480 replace outcome=2 if t1==5&Indg07m5>0&(Indg07m5<470|Indg07m5>=480) ****************************************************************** g outcome1=0 replace outcome1=1 if outcome==2&Indg07m5>0&Indg07m5<50 replace outcome1=2 if outcome==2&Indg07m5>=50&Indg07m5<100 replace outcome1=3 if outcome==2&Indg07m5>=100&Indg07m5<350 replace outcome1=4 if outcome==2&Indg07m5>=350&Indg07m5<400 replace outcome1=5 if outcome==2&Indg07m5>=400&Indg07m5<450 replace outcome1=6 if outcome==2&Indg07m5>=450&Indg07m5<480 replace outcome1=7 if outcome==2&Indg07m5>=490&Indg07m5<550 replace outcome1=8 if outcome==2&Indg07m5>=550&Indg07m5<580 replace outcome1=9 if outcome==2&Indg07m5>=580&Indg07m5<640 replace outcome1=10 if outcome==2&Indg07m5>=640&Indg07m5<690 replace outcome1=11 if outcome==2&Indg07m5>=690&Indg07m5<=750 replace outcome1=12 if outcome==2&(Indg07m5>=770&Indg07m5<840)|Indg07m5>940 replace outcome1=13 if outcome==2&Indg07m5>=850&Indg07m5<850 replace outcome1=14 if outcome==2&Indg07m5>=850&Indg07m5<860 replace outcome1=15 if outcome==2&Indg07m5>=860&Indg07m5<900 replace outcome1=16 if outcome==2&Indg07m5>=900&Indg07m5<940 tabulate outcome1 ****************************************************************** g male=0 replace male=1 if SEX==1 g age=AGE1 g degree=0 replace degree=1 if HIUL15D1==1|HIQUL15D5==1|HIQUL11D4==1 g alevel=0 replace alevel=1 if HIUL15D1==2|HIUL15D1==3|HIQUL15D5==2|HIQUL15D5==3|HIQUL11D4==2|HIQUL11D4==3 g gcse=0 replace gcse=1 if HIUL15D1==4|HIQUL15D5==4|HIQUL11D4==4 g white=1 replace white=0 if ETUKEUL1!=1 g london=0 replace london=1 if URESMC1==8|URESMC1==9 g manager=0 replace manager=1 if MANAGER1==1 g unhealthy=0 replace unhealthy=1 if LIMITK1==1 replace t0=survey+t0*91-1 replace t1=survey+t1*91 *outcome=1 indicates that a new job is secured in retailing *outcome=2 indicates that a new job is secured outside retailing *outcome=0 indicates that no new job is secured so the data are right censored g outcome1=0 replace outcome1=1 if outcome==1|outcome==2 stset t1 [pweight=lgweight], origin(time t0) failure(outcome1=1) summarize male age degree alevel gcse white london manager unhealthy stcox male age degree alevel gcse white london manager unhealthy stcurve, survival stcurve, cumhaz stset t1 [pweight=lgweight], origin(time t0) failure(outcome=0) stcompet CumInc = ci, compet1(1) compet2(2) g retail=CumInc if outcome==1 g otherjob=CumInc if outcome==2 twoway (line retail _t, sort c(J))(line otherjob _t, sort c(J)) stset t1 [pweight=lgweight], origin(time t0) failure(outcome=1) stcrreg male age degree alevel gcse white london manager unhealthy, compete(outcome==0 2) stset t1 [pweight=lgweight], origin(time t0) failure(outcome=2) stcrreg male age degree alevel gcse white london manager unhealthy, compete(outcome==0 1)