DATA sasuser.fruitfly (keep = ID ACTIVE partners THORAX Thorax_Q SLEEP LNGEVITY event) sasuser.byweek (keep = ID ACTIVE partners THORAX Thorax_Q SLEEP t_0 t_1 complete LNGEVITY) sasuser.ran_out (keep = ID ACTIVE partners THORAX Thorax_Q SLEEP t_fu final LNGEVITY day0) ; INPUT ID PARTNERS ACTIVE LNGEVITY THORAX SLEEP ; * create a event/censoring indicator for everyone; event = 1; * Quintiles; If Thorax <= 0.78 then Thorax_Q = 1; If 0.78 < Thorax <= 0.82 then Thorax_Q = 2; If 0.82 < Thorax <= 0.84 then Thorax_Q = 3; If 0.84 < Thorax <= 0.88 then Thorax_Q = 4; If 0.88 < Thorax then Thorax_Q = 5; output sasuser.fruitfly; * one observation per fly ; * RA enters data each Saturday (day 6), makes a separate record for each week, or part therof; * keep LNGEVITY just to check that done correctly; day_0 = mod(id,5) + 5*(mod(id,5)=0); * 1=Monday, 5 = Friday ; day_1 = day_0 + LNGEVITY; t_0 = 0; complete = 0; do e_day = 6 to 140 by 7; age = e_day - day_0; if e_day < day_1 then do; t_1 = age ; output sasuser.byweek; t_0 = t_1 ; end; if e_day >= day_1 and complete = 0 then do; t_1 = LNGEVITY ; complete = 1; output sasuser.byweek; end; end; * staggered entry, funding runs out day 84 ; * keeping LNGEVITY just to check that done correctly; * in practice, would only know t_fu and final, not LNGEVITY; day0 = mod(id,5)*10 + mod(id,3); * staggered entry 0 to 42 days ; day1 = day0 + LNGEVITY; if day1 <= 84 then do; t_fu = LNGEVITY ; final = 1; end; if day1 > 84 then do; t_fu = (84-day0); final = 0; end; output sasuser.ran_out; LINES; 01 8 0 35 0.64 22 02 8 0 37 0.68 9 03 8 0 49 0.68 49 04 8 0 46 0.72 1 05 8 0 63 0.72 23 06 8 0 39 0.76 83 07 8 0 46 0.76 23 08 8 0 56 0.76 15 09 8 0 63 0.76 9 10 8 0 65 0.76 81 11 8 0 56 0.80 12 12 8 0 65 0.80 15 13 8 0 70 0.80 37 14 8 0 63 0.84 24 15 8 0 65 0.84 26 16 8 0 70 0.84 17 17 8 0 77 0.84 14 18 8 0 81 0.84 14 19 8 0 86 0.84 6 20 8 0 70 0.88 25 21 8 0 70 0.88 18 22 8 0 77 0.92 26 23 8 0 77 0.92 24 24 8 0 81 0.92 29 25 8 0 77 0.94 27 01 0 9 40 0.64 18 02 0 9 37 0.70 6 03 0 9 44 0.72 19 04 0 9 47 0.72 7 05 0 9 47 0.72 16 06 0 9 47 0.76 13 07 0 9 68 0.78 35 08 0 9 47 0.80 2 09 0 9 54 0.84 35 10 0 9 61 0.84 6 11 0 9 71 0.84 15 12 0 9 75 0.84 14 13 0 9 89 0.84 18 14 0 9 58 0.88 50 15 0 9 59 0.88 25 16 0 9 62 0.88 10 17 0 9 79 0.88 33 18 0 9 96 0.88 43 19 0 9 58 0.92 35 20 0 9 62 0.92 17 21 0 9 70 0.92 27 22 0 9 72 0.92 22 23 0 9 75 0.92 16 24 0 9 96 0.92 20 25 0 9 75 0.94 37 01 1 0 46 0.64 23 02 1 0 42 0.68 4 03 1 0 65 0.72 20 04 1 0 46 0.76 42 05 1 0 58 0.76 9 06 1 0 42 0.80 32 07 1 0 48 0.80 66 08 1 0 58 0.80 28 09 1 0 50 0.82 10 10 1 0 80 0.82 4 11 1 0 63 0.84 12 12 1 0 65 0.84 17 13 1 0 70 0.84 12 14 1 0 70 0.84 23 15 1 0 72 0.84 40 16 1 0 97 0.84 18 17 1 0 46 0.88 10 18 1 0 56 0.88 38 19 1 0 70 0.88 7 20 1 0 70 0.88 23 21 1 0 72 0.88 36 22 1 0 76 0.88 9 23 1 0 90 0.88 21 24 1 0 76 0.92 62 25 1 0 92 0.92 36 01 1 1 21 0.68 23 02 1 1 40 0.68 62 03 1 1 44 0.72 28 04 1 1 54 0.76 18 05 1 1 36 0.78 10 06 1 1 40 0.80 28 07 1 1 56 0.80 22 08 1 1 60 0.80 29 09 1 1 48 0.84 15 10 1 1 53 0.84 73 11 1 1 60 0.84 10 12 1 1 60 0.84 5 13 1 1 65 0.84 13 14 1 1 68 0.84 27 15 1 1 60 0.88 20 16 1 1 81 0.88 21 17 1 1 81 0.88 12 18 1 1 48 0.90 49 19 1 1 48 0.90 17 20 1 1 56 0.90 22 21 1 1 68 0.90 71 22 1 1 75 0.90 17 23 1 1 81 0.90 10 24 1 1 48 0.92 24 25 1 1 68 0.92 18 01 8 1 16 0.64 34 02 8 1 19 0.64 6 03 8 1 19 0.68 4 04 8 1 32 0.72 22 05 8 1 33 0.72 28 06 8 1 33 0.74 31 07 8 1 30 0.76 16 08 8 1 42 0.76 27 09 8 1 42 0.76 8 10 8 1 33 0.78 32 11 8 1 26 0.80 20 12 8 1 30 0.80 35 13 8 1 40 0.82 12 14 8 1 54 0.82 14 15 8 1 34 0.84 17 16 8 1 34 0.84 29 17 8 1 47 0.84 31 18 8 1 47 0.84 6 19 8 1 42 0.88 30 20 8 1 47 0.88 27 21 8 1 54 0.88 40 22 8 1 54 0.88 19 23 8 1 56 0.88 8 24 8 1 60 0.88 8 25 8 1 44 0.92 15 ; run; title summaries for 2 groups of interest; PROC MEANS DATA = sasuser.fruitfly; CLASS active ; VAR LNGEVITY THORAX SLEEP ; WHERE (partners=1); RUN; title conventional; PROC PHREG DATA = sasuser.fruitfly; model ???*???(0) = ACTIVE THORAX / RISKLIMITS ; WHERE (partners=1); RUN; title 'weekly records'; PROC PHREG DATA = sasuser.byweek; model (???,???)*???(0) = ACTIVE THORAX / RISKLIMITS; WHERE (partners=1); RUN; title weekly records, but only the week when the event occurred; title2 (The BOSSs analysis); PROC PHREG DATA = sasuser.byweek; model (???,???)*???(0) = ACTIVE THORAX / RISKLIMITS; WHERE (partners=1 and complete=1); RUN; title funding ran out; PROC PHREG DATA = sasuser.ran_out; model ???*???(0) = ACTIVE THORAX / RISKLIMITS; WHERE (partners=1); RUN; title Thorax STRATA rather than as a regressor variable; PROC PHREG DATA = sasuser.fruitfly; model ???*???(0) = ACTIVE / RISKLIMITS ; STRATA ???; WHERE (partners=1); RUN;