/* CODE SHEET FOR FRAMINGHAM DATA FILE: 5209 RECORDS Var Name Description Range/Codes ------------------------------------------------------------- 1 lexam Last exam 2-16 for 1997 subjects who died just prior to last exam 16 for 3218 subjects who were alive at exam 16 2 dead Vital Status 0 = alive at exam 16 1 = died prior to exam 16 3 cause Cause of death 0 = still alive 1 = sudden death from CHD 2 = other coronary heart disease 3 = stroke (CVA) 4 = other cerebral vascular disease 5 = cancer 6 = other causes of death 9 = cause unknown 4 cexam Exam 1st CHD 1-16: exam at which CHD 1st diagnosed 0 = CHD never diagnosed 5 chd Death from CHD 1 = Death from cause 1 or 2 0 = Alive or death from other cause 6 cva Death from CVD 1 = Death from cause 3 or 4 0 = Alive or death from other cause 7 ca Death from CA 1 = Death from cause 5 0 = Alive or death from other cause 8 oth Death from OTH 1 = Death from cause 3-9 0 = Alive or death from CHD 9 sex Sex 1 = Male 2 = Female 10 age Age 28-62 age (years) at first exam 11 ht Height 51.5 - 76.5 height (inches) 1st exam 6 missing values (-1) 12 wt Weight 67 - 300 weight (pounds) 1st exam 6 missing values (-1) 13 scl1 SC Exam 1 96 - 503 serum cholesterol (mg/100ml) 2,037 missing values (-1)* 14 scl2 SC Exam 2 115 - 568 serum cholesterol (mg/100ml) 626 missing values (-1)* 15 dbp Diastolic 50 - 160 mm/Hg 1st exam Blood Pressure 16 sbp Systolic 82 - 300 mm/Hg 1st exam Blood Pressure 17 mrw Metropolitan 67 - 238 percent of "normal" Relative Weight 6 missing values (-1) 18 smok Amount smoked 0 - 60 cigarettes per day (exam 1) 36 missing values (-1) _____________________________________________________ * 152 subjects missing serum cholesterol at BOTH exams */ * -------------- SAS --------------- ; data sasuser.fram; INFILE "Macintosh HD:User:dad:courses:681:fram_data.txt" MISSOVER ; /* insert correct path */ INPUT lexam dead cause cexam dead_chd dead_cva dead_ca not_chd sex age ht wt scl1 scl2 dbp sbp mrw smok; IF age = -1 THEN age = . ; IF ht = -1 THEN ht = . ; IF wt = -1 THEN wt = . ; IF dbp = -1 THEN dbp = . ; IF age = -1 THEN age = . ; IF scl1 = -1 THEN scl1 = . ; IF scl2 = -1 THEN scl2 = . ; IF mrw = -1 THEN mrw = . ; IF smok = -1 THEN smok = . ; LABEL lexam = "last exam" cause = "cause of death" cexam = "exam chd dx-ed" dbp = "diastolic BP" sbp = "systolic BP" scl1 = "serum cholesterol-exam1" scl2 = "serum cholesterol-exam2" smok = "cigarettes/day" mrw = "Metropolitan Relative Weight" ; * for NEW heart disease; i_newchd = . ; t_newchd = . ; if cexam ne 1 then do; if cexam = 0 then do; i_newchd = 0; if dead = 0 then t_newchd = 2*(lexam -1) ; if dead = 1 then t_newchd = 2*(lexam -1) -1 ; end; if cexam > 0 then do; i_newchd = 1; t_newchd = 2*(cexam -1) - 1 ; end; end; * for survival analysis; fu_year = . ; if dead = 1 then fu_year = 2*(lexam -1) -1 ; if dead = 0 then fu_year = 2*(lexam -1) ; * indicator variables for male and female ; i_male = (sex = 1); i_female = (sex = 2); DROP sex; * serum cholesterol ; chol = . ; if scl1 ne . and scl2 ne . then chol = (scl1 + scl2 ) / 2; if scl1 eq . and scl2 ne . then chol = scl2 ; if scl1 ne . and scl2 eq . then chol = scl1 ; * another time scale ... ; * age ; a_newchd = age + t_newchd; fu_age = age + fu_year; * in case SAS for Mac / Unix interprets line feed or CR as a blank record ; IF lexam ne . ; RUN; options ps =75 ls = 75 NODATE; RUN; proc phreg data=sasuser.fram; model fu_year*dead(0) = i_male ; RUN; proc means data=sasuser.fram mean; class i_male; var age fu_year dead ; RUN; proc phreg data=sasuser.fram; model fu_year*dead(0) = i_male age; RUN; /* proc phreg data=sasuser.fram; model fu_year*dead(0) = i_male age chol dbp sbp mrw smok ; RUN; */ * time scales ... ; title YEAR_of_research_grant scale ; title2 restricted age range, as in Cornfield 1962; proc phreg data=sasuser.fram; model fu_year*dead(0) = i_male ; where (40 <= age <= 59); RUN; title .... AGE (rather than YEAR_of_research_grant) scale ... ; title2 .... restricted age range, as in Cornfield 1962 ....... ; title3 .... NOTE the way the delayed entry is specified ...... ; proc phreg data=sasuser.fram; model (age,fu_age)*dead(0) = i_male ; where (40 <= age <= 59); RUN; title4 . risk set (vertical) based on deaths in a calendar (project) year ; proc PLOT data=sasuser.fram; PLOT fu_age*fu_year = '^' ; where ( (40 <= age <= 59) and (dead = 1) ) ; RUN; title4 ..... risk set (horizontal) based on deaths at a particular age .... ; proc PLOT data=sasuser.fram; PLOT fu_age*fu_year = ">" ; where ( (40 <= age <= 59) and (dead = 1) ) ; RUN;