/*-------------------------------------------------------------- /* /* This is Richard Potter's rewrite of the Amherst data example /* to illustrate further features of SAS /* /*-------------------------------------------------------------- STOR 664 - Applied Statistics I Chapter 2 Amherst data analyzed using SAS, p. 43 of course pack. --------------------------------------------------------------*/ Title1 'Amherst: Chapter 2: Simple Linear Regression'; data amherst; /* give your data set a name */ input yr temp; /* tell SAS the names (and indirectly, the number) of the columns in your data */ yr1 = yr-81.5; /* center year */ datalines; /* indicate the start of embedded data */ 1 7.29 2 7.19 3 6.53 4 8.34 5 6.40 6 6.15 7 6.68 8 5.86 9 6.29 10 7.03 11 7.36 12 7.02 13 6.81 14 6.52 15 6.63 16 6.34 17 6.26 18 6.82 19 7.00 20 6.69 21 5.77 22 6.49 23 6.55 24 6.39 25 6.86 26 6.78 27 6.65 28 6.61 29 7.32 30 7.45 31 6.83 32 6.51 33 5.98 34 6.72 35 8.18 36 6.86 37 6.64 38 6.23 39 6.53 40 5.42 41 7.20 42 8.15 43 8.34 44 7.18 45 7.80 46 7.92 47 7.37 48 6.62 49 7.68 50 6.48 51 7.14 52 7.36 53 6.02 54 8.19 55 7.31 56 7.92 57 7.12 58 5.65 59 7.07 60 6.66 61 7.09 62 7.17 63 7.68 64 7.02 65 7.54 66 7.06 67 7.04 68 6.86 69 5.29 70 6.38 71 7.22 72 6.00 73 7.44 74 7.04 75 7.31 76 7.42 77 6.88 78 8.34 79 6.53 80 7.77 81 6.60 82 5.69 83 6.85 84 7.71 85 6.80 86 8.42 87 7.32 88 6.77 89 6.76 90 7.24 91 5.91 92 7.40 93 7.40 94 7.31 95 7.89 96 8.40 97 7.84 98 7.71 99 6.80 100 7.06 101 7.50 102 8.09 103 8.18 104 7.49 105 6.47 106 7.82 107 7.96 108 7.14 109 7.75 110 7.52 111 7.93 112 7.82 113 7.78 114 9.66 115 7.93 116 8.33 117 8.71 118 9.35 119 8.26 120 8.47 121 7.50 122 8.63 123 6.93 124 8.39 125 7.79 126 7.73 127 7.02 128 7.19 129 8.22 130 7.35 131 7.51 132 7.27 133 7.61 134 7.90 135 7.52 136 7.64 137 7.28 138 8.88 139 7.80 140 8.37 141 7.81 142 8.34 143 7.33 144 8.40 145 7.84 146 8.45 147 7.84 148 7.91 149 8.03 150 8.46 151 8.42 152 8.59 153 8.32 154 8.26 155 10.21 156 9.97 157 7.92 158 8.46 159 8.20 160 8.92 161 8.56 162 8.56 175 . /* the period "." indicates a missing value */ ; /* don't forget to tack on a semicolon below the last line of data */ run; /* ------------------------------------------------------------------------ If you want to see the data set in the output window, use PROC PRINT. In this program, simply delete the leading asterisk in the next 3 lines. ------------------------------------------------------------------------ */ * title2 'amherst data'; * proc print data=amherst; * run; title2 'amherst parameter estimates'; proc reg data=amherst; model temp = yr1 /cli; output p=predval r=resid1; run; quit;