/* The slash asterisk to start with, and asterisk slash to end with is a way to put comments and notes to oneself into the SAS program. From Fundamentals of BIOSTATISTICS , 5th Edition, by Bernard Rosner 2000 Datasets from Fundamentals of Biostatistics --------------------------------------------------------------------- Variable Column Code --------------------------------------------------------------------- ID 2-8 Age 9-11 Age (yrs) zyg 12-14 1=mz 2=dz Twin 1 ht1 15-19 Height (cm) wt1 20-24 Weight (kg) tea1 25-29 Tea (cups/week) cof1 30-34 Coffee (cups/week) alc1 35-39 Alcohol (drinks/week) cur1 40-44 Current Smoking (cigarretes/day) men1 45-49 Menopause Status (1=pre/2=post/3=unknown hysterectomy) pyr1 50-55 Pack-years smoking ls1 56-61 Lumbar spine (g/cm**2) fn1 62-67 Femoral neck (g/cm**2) fs1 68-73 Femoral shaft (g/cm**2) Twin 2 (heavier one) ht2 74-78 Height (cm) wt2 79-83 Weight (kg) tea2 84-88 Tea (cups/week) cof2 89-93 Coffee (cups/week) alc2 94-98 Alcohol (drinks/week) cur2 99-103 Current Smoking (cigarretes/day) men2 104-108 Menopause Status (1=pre/2=post/3=unknown hysterectomy) pyr2 109-114 Pack-years smoking ls2 115-120 Lumbar spine (g/cm**2) fn2 121-126 Femoral neck (g/cm**2) fs2 127-132 Femoral shaft (g/cm**2) --------------------------------------------------------------------- comments end here */ /* highlight from here ----------- */ data sasuser.boneden; INPUT ID age zyg ht1 wt1 tea1 cof1 alc1 cur1 men1 pyr1 ls1 fn1 fs1 ht2 wt2 tea2 cof2 alc2 cur2 men2 pyr2 ls2 fn2 fs2; LINES; 1002501 27 2 162 57 35 0 1 1 0 0 0.81 0.72 1 160 56 42 21 0 0 0 13.75 0.76 0.68 1.04 1015401 42 2 165 76 42 2 3 5 1 0 1.01 0.74 0.99 159 72 20 21 1 1 0 48 0.89 0.64 1.11 1027601 59 2 150 114 12 0 0 0 1 0 0.75 0.63 1.05 156 54 7 28 0 0 1 20.5 0.51 0.64 0.86 1034301 61 1 159 62 56 0 0 0 1 0 0.81 0.64 1.12 162 58 21 35 0 0 1 29.75 0.85 0.69 1.03 1121202 47 2 159 58 28 14 0 0 0 0 0.78 0.7 1.14 150 58 91 0 0 1 1 25 0.59 0.54 0.96 1162502 33 2 163 49 35 0 3 1 0 0 0.86 0.56 1.13 158 54 14 14 0 0 0 5 0.83 0.5 1.06 1188701 45 1 169 78 42 0 1 1 0 0 0.95 0.83 1.16 169 84 21 42 2 5 0 42 0.87 0.78 1.23 1248202 73 1 160 76 42 14 14 8 1 25 0.76 0.56 1.05 161 76 7 7 14 10 1 40 0.66 0.49 1.04 1268301 43 2 162 64 7 28 8 3 0 0.5 0.83 0.65 1.07 162 60 14 7 7 7 0 10 0.98 0.77 1.15 1269402 43 2 165 58 7 21 6 0 1 0 1.01 0.9 1.3 168 62 0 35 35 30 2 39 0.89 0.87 1.24 1273101 47 2 168 60 28 28 7 7 1 16.5 0.86 0.7 1.24 163 53 0 68 0 0 0 31 0.76 0.74 1.21 1323501 47 1 168 70 0 21 0 0 0 0 0.71 0.85 1.21 167 65 0 28 0 0 0 23.25 0.8 0.76 1.09 1337102 72 1 154 81 14 7 0 0 1 0 0.71 0.55 0.93 160 80 0 0 0 0 1 18.5 0.63 0.56 1.01 1467301 58 1 161 61 0 21 0 0 1 0 0.7 0.68 1.18 160 73 0 14 0 2 1 39 0.63 0.64 1.04 1479401 36 1 162 55 7 14 2 0 0 0 0.73 0.64 1.09 163 54 0 35 0 0 0 25.5 0.7 0.61 1.2 1494101 47 1 149 61 0 42 2 3 1 12 0.71 0.61 1.09 154 94 0 0 0 1 2 20 0.76 0.66 0.99 1497701 53 1 162 62 56 0 9 8 1 33.75 0.73 0.82 1.13 162 55 14 21 9 8 1 43.75 0.77 0.88 1.18 1505502 49 1 164 70 0 28 0 1 2 0 0.83 0.66 1.01 165 67 14 28 9 7 0 32 0.79 0.63 1.15 1519402 52 1 157 53 28 28 1 1 1 0 0.65 0.66 0.98 160 55 28 0 0 3 1 13.2 0.64 0.71 1.01 1521701 44 1 167 60 0 28 23 22 0 0 0.77 0.66 1.1 167 43 0 28 13 20 0 30 0.71 0.61 0.96 1528201 55 1 165 68 56 0 2 3 1 0 0.75 0.59 1.14 165 71 21 28 0 1 1 20.25 0.64 0.65 1.15 1536201 44 1 165 70 0 7 1 0 1 0 0.89 0.78 1.02 165 58 0 42 16 10 1 36.25 0.84 0.63 1.12 1536701 34 2 162 60 0 49 0 0 2 0 0.62 0.61 1.23 170 72 0 21 0 0 0 12 0.65 0.81 1.33 1541902 37 2 163 60 1 42 8 3 0 0 1.04 0.82 1.24 163 50 0 35 7 7 0 11.25 0.92 0.67 1.08 1543602 34 2 168 57 42 0 0 0 0 0 0.87 0.65 1.01 162 58 42 0 0 0 0 8 0.9 0.76 1.06 1596702 46 2 163 58 42 0 0 4 0 0 0.95 0.71 1.12 157 51 0 35 0 0 0 14 0.96 0.71 1.06 1597002 49 1 164 72 21 14 9 12 1 19 0.67 0.74 1.14 164 68 21 12 14 11 1 36.3 0.74 0.74 1.1 1597601 36 1 163 112 1 0 0 0 0 18 0.71 0.6 1.12 167 84 28 0 2 0 0 30 0.84 0.85 1.16 1607901 62 2 171 97 0 7 0 0 1 0 0.5 0.49 1.15 166 56 14 56 8 4 1 43.2 0.47 0.48 0.73 1608801 76 2 161 59 0 7 28 28 1 0 0.69 0.54 0.81 155 55 35 0 0 0 1 48 0.48 0.38 0.64 1628601 53 1 161 68 35 35 0 0 1 24.65 0.82 0.69 1.11 161 60 0 99 0 1 1 30 0.77 0.67 1.08 1635901 42 1 166 66 7 7 10 15 0 0 0.93 0.73 1.14 165 60 7 14 14 10 0 8 0.96 0.83 1.24 1637901 47 1 157 65 14 7 2 2 2 0 0.8 0.67 1.22 165 62 0 28 14 13 0 6 0.75 0.63 1.12 1640701 44 1 151 48 12 0 0 0 0 28 0.86 0.6 1.05 153 52 91 0 0 0 2 56 0.85 0.54 0.97 1643602 71 2 153 49 21 7 1 0 1 0 0.5 0.47 0.89 154 43 7 7 14 14 1 64.5 0.61 0.54 0.86 1647502 72 1 152 48 14 56 0 0 1 1.3 0.58 0.42 0.7 155 50 14 42 0 0 1 12.6 0.51 0.46 0.66 1648701 40 2 159 54 21 42 0 0 1 0 0.98 0.69 1.11 161 59 7 21 2 0 0 15.75 0.9 0.64 1.21 1657301 49 2 164 55 21 7 21 22 1 0 0.76 0.65 1.42 164 52 14 0 28 28 1 21 0.68 0.62 1.22 1671001 45 2 161 47 35 0 5 0 2 0 0.93 0.57 1.06 165 60 0 42 7 14 2 39 0.86 0.71 1.03 1672702 41 2 159 72 0 14 0 0 0 0 0.82 0.67 1.06 164 53 0 35 1 0 0 18.75 0.92 0.79 1.02 2609801 48 2 164 71 10 0 0 0 0 0 0.95 0.81 1.25 158 88 24 0 0 0 1 48 0.85 0.72 1.31 ; RUN; /* ---- to here and click on the "run" icon (the little guy running) -----; options ls = 75 ps = 50; run; /* to change lines per page and page width */ /* highlight from just after HERE -----; PROC MEANS data=sasuser.boneden; run; /* to just before HERE; then click on "run" to run the MEANS PROCedure */ /* etc... */ PROC SORT DATA=sasuser.boneden; by zyg; PROC CORR data=sasuser.boneden; by zyg; VAR ht1 ht2 wt1 wt2; RUN; /* the material below is not needed for the assignment , but is given for interest to show how one can 'Reshape" datasets with SAS */ /* make a dataset with one "observation" per woman*/ PROC sort data=sasuser.boneden; by ID; DATA sasuser.bonedens; /* new file to be created */ KEEP ID twin age zyg ht wt tea cof alc cur men pyr ls fn fs pairno; ARRAY twin1(11) ht1 wt1 tea1 cof1 alc1 cur1 men1 pyr1 ls1 fn1 fs1; ARRAY twin2(11) ht2 wt2 tea2 cof2 alc2 cur2 men2 pyr2 ls2 fn2 fs2; ARRAY woman(11) ht wt tea cof alc cur men pyr ls fn fs; RETAIN pairno 0; SET sasuser.boneden; pairno=pairno+1; twin=1; DO i=1 to 11; woman(i)=twin1(i); end; output; twin=2; DO i=1 to 11; woman(i)=twin2(i); end; output; RUN;