ODS RTF FILE = 'C:\Documents and Settings\rjchar2\My Documents\CPH931F09\WA1SAS931F09.rtf'; * SAS code for CPH 931 Written Assignment 1 Fall 2009; * Exercise 2; PROC IMPORT DATAFILE = 'C:\Documents and Settings\rjchar2\My Documents\CPH931F09\BloodPressure.xls' OUT = WA1 DBMS = EXCEL REPLACE; SHEET = Sheet1; GETNAMES = YES; RUN; PROC MIXED DATA = WA1 method = type3 covtest; CLASS SUBJECT MED; MODEL SBP = MED / SOLUTION noint; RANDOM SUBJECT; contrast '1 versus 2' MED 1 -1 0 ; contrast '1 versus 3' MED 1 0 -1 ; contrast '2 versus 3' MED 0 1 -1 ; RUN; * Exercise 4; PROC MIXED DATA = WA1 method = ML covtest; CLASS SUBJECT MED PERS; MODEL SBP = MED PERS MED*PERS EXER / SOLUTION; RANDOM SUBJECT; contrast 'part b: test null hypothesis of no exercise effect' EXER 1; estimate '(i) expected SBP for a type A person on med 1 (no exercise)' INT 1 MED 1 0 0 PERS 1 0 MED*PERS 1 0 0 0 0 0; estimate '(ii) expected SBP for a type A person on med 2 (no exercise)' INT 1 MED 0 1 0 PERS 1 0 MED*PERS 0 0 1 0 0 0; estimate '(iii) expected SBP for a type A person on med 3 (no exercise)' INT 1 MED 0 0 1 PERS 1 0 MED*PERS 0 0 0 0 1 0; estimate '(iv) difference between (i) and (ii)' MED 1 -1 0 MED*PERS 1 0 -1 0 0 0; estimate '(v) difference between (i) and (iii)' MED 1 0 -1 MED*PERS 1 0 0 0 -1 0; estimate '(vi) difference between (ii) and (iii)' MED 0 1 -1 MED*PERS 0 0 1 0 -1 0; contrast 'part c: test null hypothesis that (iv) = (v) = (vi) = 0' MED 1 -1 0 MED*PERS 1 0 -1 0 0 0, MED 1 0 -1 MED*PERS 1 0 0 0 -1 0, MED 0 1 -1 MED*PERS 0 0 1 0 -1 0; estimate '(vii) expected SBP for a type B person on med 1 (no exercise)' INT 1 MED 1 0 0 PERS 0 1 MED*PERS 0 1 0 0 0 0; estimate '(viii) expected SBP for a type B person on med 2 (no exercise)' INT 1 MED 0 1 0 PERS 0 1 MED*PERS 0 0 0 1 0 0; estimate '(ix) expected SBP for a type B person on med 3 (no exercise)' INT 1 MED 0 0 1 PERS 0 1 MED*PERS 0 0 0 0 0 1; estimate '(x) difference between (vii) and (viii)' MED 1 -1 0 MED*PERS 0 1 0 -1 0 0; estimate '(xi) difference between (vii) and (ix)' MED 1 0 -1 MED*PERS 0 1 0 0 0 -1; estimate '(xii) difference between (viii) and (ix)' MED 0 1 -1 MED*PERS 0 0 0 1 0 -1; contrast 'part d: test null hypothesis that (iv) = (v) = (vi) = (x) = (xi) = (xii) = 0' MED 1 -1 0 MED*PERS 1 0 -1 0 0 0, MED 1 0 -1 MED*PERS 1 0 0 0 -1 0, MED 0 1 -1 MED*PERS 0 0 1 0 -1 0, MED 1 -1 0 MED*PERS 0 1 0 -1 0 0, MED 1 0 -1 MED*PERS 0 1 0 0 0 -1, MED 0 1 -1 MED*PERS 0 0 0 1 0 -1; contrast 'part e: test null hypothesis that (iv) - (x) = (v) - (xi) = (vi) - (xii) = 0' MED*PERS 1 -1 -1 1 0 0, MED*PERS 1 -1 0 0 -1 1, MED*PERS 0 0 1 -1 -1 1; estimate '(xiii) expected SBP for a type A person on med 3 (4 days exercise)' INT 1 MED 0 0 1 PERS 1 0 MED*PERS 0 0 0 0 1 0 EXER 4; estimate '(xiv) expected SBP for a type A person on med 2 (0 days exercise)' INT 1 MED 0 1 0 PERS 1 0 MED*PERS 0 0 1 0 0 0 EXER 0; estimate 'part f: (xiii) - (xiv)' MED 0 -1 1 MED*PERS 0 0 -1 0 1 0 EXER 4; RUN; ODS RTF CLOSE; RUN;