/* filename: KS-fish_4-15-02__pre-post-delta_.txt directory: C:\Documents and Settings\John Bailer\My Documents\baileraj\Classes\Fall 2003\SAS-programs Swim test data generated by S. Roark – pgm from B. Noble and K. See */ options ls=78 formdlim='-' nodate pageno=1 ps=2000; title KS-fish 3-8swim 3-8-02; data swim1; input prebm postbm fish gpif gpis pgmf pgms ldhs hlwi Ucrit0 Ucrit1 TTF0 TTF1 delta supp sex; if ttf1=0 then ttf1=0.001; *velocity1=Ucrit1; *velocity0=Ucrit0; cards; 2 2.4 1 22 22 13 33 12 0.4 46.02 35.74 124.08 82.96 41.12 1 1 2.7 2.3 2 22 22 13 23 11 0.4 34.38 15 77.52 0 77.52 1 1 2 2 3 22 22 12 33 11 0.2 42.56 35.84 110.24 83.36 26.88 1 1 1.9 2.2 4 22 22 13 13 11 0.4 35.8 25.74 83.2 42.96 40.24 1 1 1.8 1.6 5 23 33 22 33 12 0.4 40.43 36.7 101.72 86.8 14.92 1 1 2.5 2.6 6 22 22 13 13 11 0.4 40.9 20.12 103.6 20.48 83.12 1 1 1.9 2.1 7 23 22 23 33 11 0.4 40.95 41.24 103.8 104.96 -1.16 1 1 2 1.6 8 23 22 23 33 12 0.6 35.74 31.44 82.96 65.76 17.2 1 1 1.4 1.9 9 23 22 13 33 13 0.6 35.91 16.98 83.64 7.92 75.72 1 1 1.9 1.8 10 23 22 13 23 12 0.8 35.64 40.94 82.56 103.76 -21.2 1 1 1.6 1.6 11 22 22 23 33 11 0.2 41.13 40.76 104.52 103.04 1.48 1 1 2.2 1.9 12 22 22 13 23 12 0.6 37.4 30.35 89.6 61.4 28.2 1 1 2 1.9 13 23 22 12 33 12 0.6 39.95 36.46 99.8 85.84 13.96 1 1 1.6 1.7 14 33 23 13 13 12 0.8 31.26 29.75 65.04 59 6.04 1 1 1.7 1.7 15 22 23 12 33 12 0.6 31.18 35.96 64.72 83.84 -19.12 1 1 2.4 2.4 16 12 22 23 33 11 0.4 38.3 39.98 93.2 99.92 -6.72 1 1 1.3 1.1 17 22 22 22 23 11 0.2 37.42 30.53 89.68 62.12 27.56 2 1 1.5 1.8 18 22 23 11 33 11 0.2 36.68 31.53 86.72 66.12 20.6 2 1 1.7 1.8 19 22 22 23 33 11 0.2 30.58 26.65 62.32 46.6 15.72 2 1 2.1 2.1 20 22 23 22 13 11 0.4 40.71 32.31 102.84 69.24 33.6 2 1 1.9 2.1 21 22 12 12 33 12 0.6 45.66 15.24 122.64 0.96 121.68 2 1 1.4 1.8 22 23 23 11 13 12 0.8 40.46 41.13 101.84 104.52 -2.68 2 1 1.5 1.8 23 22 33 22 13 12 0.4 40.39 32.26 101.56 69.04 32.52 2 1 1.4 1.5 24 22 22 23 23 11 0.4 41.04 38.5 104.16 94 10.16 2 1 1.3 1.1 25 22 22 13 33 11 0.2 40.75 31.05 103 64.2 38.8 2 1 1.6 1.7 26 22 23 13 33 11 0.4 37.41 31.87 89.64 67.48 22.16 2 1 2.4 2.2 27 22 23 22 12 11 0.4 34.38 31.67 77.52 66.68 10.84 3 1 2.2 2.5 28 23 22 22 12 11 0.4 41.95 26.38 107.8 45.52 62.28 3 1 2.2 2.2 29 22 22 22 13 12 0.4 41.89 40.4 107.56 101.6 5.96 3 1 1.9 2.2 30 22 22 23 33 11 0.2 40.95 40.28 103.8 101.12 2.68 3 1 2.1 2 31 22 22 13 33 11 0.2 42 36.81 108 87.24 20.76 3 1 2.3 2.1 32 22 22 12 33 11 0.2 37.54 29.5 90.16 58 32.16 3 1 1.8 1.9 33 33 12 23 13 11 0.6 38.76 41.67 95.04 106.68 -11.64 3 1 2.3 2.3 34 33 22 23 13 11 0.4 45.68 36.96 122.72 87.84 34.88 3 1 1.5 1.5 35 23 22 12 11 12 0.6 40.73 35.31 102.92 81.24 21.68 3 1 1.8 1.7 36 23 12 23 13 11 0.8 41.03 17.55 104.12 10.2 93.92 3 1 1.8 1.9 37 22 23 12 11 11 0.4 41.21 35.84 104.84 83.36 21.48 3 1 2.1 2 38 22 22 22 33 11 0 40.71 37.55 102.84 90.2 12.64 3 1 1.7 1.7 39 33 23 23 13 11 0.6 40.25 26.21 101 44.84 56.16 3 1 1.8 1.8 40 22 22 13 33 11 0.2 41.02 40.33 104.08 101.32 2.76 3 1 2.1 2.2 41 22 23 23 11 11 0.4 41 35.3 104 81.2 22.8 3 1 1.6 2 42 22 22 22 13 11 0.2 42.25 51.04 109 144.16 -35.16 3 1 1.4 1.2 43 22 22 23 33 12 0.4 35.55 15 82.2 0 82.2 1 0 1.8 1.7 44 22 22 33 33 11 0 35.74 40.45 82.96 101.8 -18.84 1 0 1.6 1.4 45 23 22 23 33 12 0.6 32.12 37.49 68.48 89.96 -21.48 1 0 1.5 1.4 46 22 22 13 13 11 0.4 32.15 31.66 68.6 66.64 1.96 1 0 1.5 1.4 47 22 22 12 33 13 0.4 30.03 27.5 60.12 50 10.12 1 0 1.7 1.5 48 33 23 23 33 12 0.6 38.06 31.68 92.24 66.72 25.52 1 0 1.5 1.3 49 22 22 23 33 11 0.2 45.68 35.56 122.72 82.24 40.48 1 0 1.4 1.4 50 22 22 23 33 12 0.4 37.25 23.43 89 33.72 55.28 1 0 1.6 1.6 51 23 23 13 33 12 0.8 30.58 15.2 62.32 0.8 61.52 1 0 1.4 1.2 52 23 22 33 33 12 0.4 35.58 22.25 82.32 29 53.32 1 0 1.6 1.4 53 22 22 13 33 12 0.4 35.5 28.14 82 52.56 29.44 1 0 1.3 1.4 54 22 22 11 23 11 0.2 36.2 37.25 84.8 89 -4.2 1 0 1.4 1.6 55 22 22 11 23 12 0.4 32.4 15 69.6 0 69.6 1 0 1.2 1.6 56 23 22 13 13 12 0.8 35.55 36.19 82.2 84.76 -2.56 1 0 1.4 1.3 57 22 23 22 33 11 0.2 35.84 27.21 83.36 48.84 34.52 1 0 1.4 1.4 58 22 22 12 13 11 0.4 40.4 32.93 101.6 71.72 29.88 2 0 2.1 1.7 59 22 22 23 23 12 0.6 31.6 30.85 66.4 63.4 3 2 0 2 1.4 60 22 22 12 33 11 0.2 36.3 30.99 85.2 63.96 21.24 2 0 1.6 1.6 61 22 22 12 33 11 0.2 36.26 35.42 85.04 81.68 3.36 2 0 1.4 1.9 62 23 22 22 12 12 0.6 32.42 32.17 69.68 68.68 1 2 0 1.7 1.1 63 23 23 23 23 11 0.8 31.82 38.5 67.28 94 -26.72 2 0 1.7 1.3 64 22 22 12 33 12 0.4 30.38 31.13 61.52 64.52 -3 2 0 2.1 1.8 65 23 22 12 13 12 0.8 35.63 28.54 82.52 54.16 28.36 2 0 1.4 1.5 66 22 22 22 33 11 0 37.53 31.38 90.12 65.52 24.6 2 0 1.6 1.5 67 23 22 22 13 11 0.4 36.78 41.15 87.12 104.6 -17.48 2 0 1.8 1.9 68 23 22 12 23 11 0.6 41.18 35.67 104.72 82.68 22.04 2 0 1.6 1.5 69 22 22 12 33 12 0.4 36.21 31.73 84.84 66.92 17.92 2 0 1.5 1.4 70 22 22 22 33 11 0 35.63 35.31 82.52 81.24 1.28 2 0 1.7 1.5 71 22 22 23 23 12 0.6 40.7 36 102.8 84 18.8 2 0 1.7 1.8 72 22 22 23 12 11 0.4 29.63 35.7 58.52 82.8 -24.28 2 0 1.7 1.4 73 23 22 12 11 12 0.6 41.43 37.49 105.72 89.96 15.76 3 0 1.8 1.7 74 22 22 23 11 11 0.2 43.05 34.04 112.2 76.16 36.04 3 0 1.8 1.8 75 33 22 13 33 11 0.2 42.25 25.79 109 43.16 65.84 3 0 1.5 1.6 76 22 22 23 13 11 0.4 38.93 20.74 95.72 22.96 72.76 3 0 1.3 1.4 77 23 22 12 13 12 0.8 40.53 29.88 102.12 59.52 42.6 3 0 1.6 1.7 78 22 22 23 11 11 0.2 35.79 25.88 83.16 43.52 39.64 3 0 1.3 1.4 79 22 22 22 11 12 0.2 40.7 32.24 102.8 68.96 33.84 3 0 1.4 1.3 80 33 22 22 13 12 0.4 38.52 35.75 94.08 83 11.08 3 0 1.5 1.9 81 22 22 13 11 11 0.2 36.18 31.62 84.72 66.48 18.24 3 0 1.6 1.7 82 33 22 23 13 12 0.6 41.63 33 106.52 72 34.52 3 0 1.6 1.6 83 22 22 23 33 11 0.2 36.42 37.01 85.68 88.04 -2.36 3 0 1.5 1.5 84 22 22 12 13 11 0.4 39.21 31.07 96.84 64.28 32.56 3 0 1.3 1.3 85 12 22 12 13 11 0.6 39.42 31.05 97.68 64.2 33.48 3 0 ; run; *proc print; data swim2; set swim1; event=1; time=7; title swim2 data - convert into LB values; if 0<=TTF1<20 then tinterval=1; if tinterval=1 then t=20; if 20<=TTF1<40 then tinterval=2; if tinterval=2 then t=40; if 40<=TTF1<60 then tinterval=3; if tinterval=3 then t=60; if 60<=TTF1<80 then tinterval=4; if tinterval=4 then t=80; if 80<=TTF1<100 then tinterval=5; if tinterval=5 then t=100; if 100<=TTF1<120 then tinterval=6; if tinterval=6 then t=120; if TTF1>120 then tinterval=7; if tinterval=7 then t=140; * if TTF1>=140 then timeinterval=8 and t=160; if 15<=Ucrit1<20 then velocity1=15; *Post velocity; if 20<=Ucrit1<25 then velocity1=20; if 25<=Ucrit1<30 then velocity1=25; if 30<=Ucrit1<35 then velocity1=30; if 35<=Ucrit1<40 then velocity1=35; if 40<=Ucrit1<45 then velocity1=40; if 45<=Ucrit1<50 then velocity1=45; if Ucrit1>= 50 then velocity1=50; if 15<=Ucrit0<20 then velocity0=15; *Pre velocity; if 20<=Ucrit0<25 then velocity0=20; if 25<=Ucrit0<30 then velocity0=25; if 30<=Ucrit0<35 then velocity0=30; if 35<=Ucrit0<40 then velocity0=35; if 40<=Ucrit0<45 then velocity0=40; if 45<=Ucrit0<50 then velocity0=45; if Ucrit0>= 50 then velocity0=50; proc print data=swim2(obs=10); var fish event velocity1 TTF1 tinterval t; run; proc lifetest data=swim2 method=life plots=(s,h) intervals=20 40 60 80 100 120; title lifereg - survival function and hazard function; time TTF1*event(0); title LIFETEST - plot of survival and hazard vs time; run; /* data swim3; set swim2; period=7; * ceil(TTF1/20)?; do j=1 to period; time=7; outevent =0; if j=period and event=1 then do; outevent=1; time=t; /*TTF1-20*(period-1)?;*/; * LTIME=log(time); ** for GENMOD part below; /* end; output; end; run; */ data swim3; set swim2; bodymass_d=prebm-postbm;velocity_d=velocity0-velocity1; j = tinterval; event=12; run; proc print data=swim3(obs=15); proc lifereg data=swim3; title Lifereg: ttf1 velocity 1 - post; class gpif gpis pgmf pgms ldhs supp sex; model ttf1=gpif gpis pgmf pgms ldhs hlwi supp sex velocity1 /dist=exponential; run; /*proc lifereg data=swim3; title ttf0 velocity 0 - pre; class gpif gpis pgmf pgms ldhs supp sex; model ttf0=gpif gpis pgmf pgms ldhs hlwi supp sex velocity0 /dist=exponential; run;*/ proc genmod data=swim3; title Genmode: ttf1 velocity 1 - post; class gpif gpis pgmf pgms ldhs supp sex velocity1; model ttf1 = velocity1 gpif gpis pgmf pgms ldhs supp sex postbm / dist=gamma link=log type3; *exponential not working in GENMOD?; lsmeans gpif / diff; lsmeans gpis / diff; lsmeans ldhs / diff; run; proc genmod data=swim3; title Genmode: ttf0 velocity 0 - pre; class gpif gpis pgmf pgms ldhs supp sex velocity0; model ttf0 = velocity0 gpif gpis pgmf pgms ldhs supp sex prebm / dist=gamma link=log type3; *exponential not working in GENMOD?; lsmeans ldhs / diff; run; proc genmod data=swim3; title Genmode: delta=pre-post; class gpif gpis pgmf pgms ldhs supp sex velocity0 velocity1; model delta = velocity_d gpif gpis pgmf pgms ldhs supp sex bodymass_d / dist=normal link=identity type3; *exponential not working in GENMOD?; lsmeans pgms / diff; run; proc genmod data=swim3; title HLWI: post; class supp sex hlwi; model ttf1 = supp sex hlwi / dist=gamma link=log type3; run; proc genmod data=swim3; title HLWI pre; class supp sex hlwi; model ttf0 = supp sex hlwi / dist=gamma link=log type3; *exponential not working in GENMOD?; run; proc genmod data=swim3; title HLWI delta=pre-post; class supp sex hlwi; model delta = supp sex hlwi / dist=normal link=identity type3; *exponential not working in GENMOD?; run;