Multiple linear regression in SAS
Step 1) Load the data
There are four variable in the data set below:
college GPA
high school GPA
SAT score
quality of the letters of recommendation (1-10)
Our objective is to predict college GPA using the other three variables.
Step 2) Compute the least squares estimates
Open the "analyst" window by clicking solutions/analysis/analyst and retrieve
the dataset by clicking file/open by SAS name/ (Work->GPA).
Open the regression menu by clicking statistics/regression/linear. Enter college_GPA
as the dependent variable and HS_GPA, SAT, and Quality_of_letters as the
explanatory variables. Click "OK".
data GPA;
input college_GPA HS_GPA SAT Quality_of_letters;
intGPASAT=HS_GPA*SAT;
intGPAQOL=HS_GPA*Quality_of_letters;
intSATQOL=SAT*Quality_of_letters;
int3WAY=HS_GPA*SAT*Quality_of_letters;
datalines;
2.04 2.01 1070 5
2.56 3.40 1254 6
3.75 3.68 1466 6
1.10 1.54 706 4
3.00 3.32 1160 5
0.05 0.33 756 3
1.38 0.36 1058 2
1.50 1.97 1008 7
1.38 2.03 1104 4
4.01 2.05 1200 7
1.50 2.13 896 7
1.29 1.34 848 3
1.90 1.51 958 5
3.11 3.12 1246 6
1.92 2.14 1106 4
0.81 2.60 790 5
1.01 1.90 954 4
3.66 3.06 1500 6
2.00 1.60 1046 5
2.05 1.96 1054 4
2.60 1.96 1198 6
2.55 1.56 940 3
0.38 1.60 456 6
2.48 1.92 1150 7
2.74 3.09 636 6
1.77 0.78 744 5
1.61 2.12 644 5
0.99 1.85 842 3
1.62 1.78 852 5
2.03 1.03 1170 3
3.50 3.44 1034 10
3.18 2.42 1202 5
2.39 1.74 1018 5
1.48 1.89 1180 5
1.54 1.43 952 3
1.57 1.64 1038 4
2.46 2.69 1090 6
2.42 1.79 694 5
2.11 2.72 1096 6
2.04 2.15 1114 5
1.68 2.22 1256 6
1.64 1.55 1208 5
2.41 2.34 820 6
2.10 2.92 1222 4
1.40 2.10 1120 5
2.03 1.64 886 4
1.99 2.83 1126 7
2.24 1.76 1158 4
0.45 1.81 676 6
2.31 2.68 1214 7
2.41 2.55 1136 6
2.56 2.70 1264 6
2.50 1.66 1116 3
2.92 2.23 1292 4
2.35 2.01 604 5
2.82 1.24 854 6
1.80 1.95 814 6
1.29 1.73 778 3
1.68 1.08 800 2
3.44 3.46 1424 7
1.90 3.01 950 6
2.06 0.54 1056 3
3.30 3.20 956 8
1.80 1.50 1352 5
2.00 1.71 852 5
1.68 1.99 1168 5
1.94 2.76 970 6
0.97 1.56 776 4
1.12 1.78 854 6
1.31 1.32 1232 5
1.68 0.87 1140 6
3.09 1.75 1084 4
1.87 1.41 954 2
2.00 2.77 1000 4
2.39 1.78 1084 4
1.50 1.34 1058 4
1.82 1.52 816 5
1.80 2.97 1146 7
2.01 1.75 1000 6
1.88 1.64 856 4
1.64 1.80 798 4
2.42 3.37 1324 6
0.22 1.15 704 6
2.31 1.72 1222 5
0.95 2.27 948 6
1.99 2.85 1182 8
1.86 2.21 1000 6
1.79 1.94 910 6
3.02 4.25 1374 9
1.85 1.83 1014 6
1.98 2.75 1420 7
2.15 1.71 400 6
1.46 2.20 998 7
2.29 2.13 776 6
2.39 2.38 1134 7
1.80 1.64 772 4
2.64 1.87 1304 6
2.08 2.53 1212 4
0.70 1.78 818 6
0.89 1.20 864 2
;;;;
proc reg data = GPA;
model college_GPA = HS_GPA SAT Quality_of_letters
intGPASAT intGPAQOL intSATQOL
int3WAY;
interactions: test intGPASAT,intGPAQOL, intSATQOL, int3WAY;
run;