***Problem 9-6; p. 317, 5th ed. ================================== OPTION PS=40 LS=70; DATA EXERCISE; DO SUBJ = 1 TO 500; IF RANUNI(155) LT .5 THEN GENDER = 'Female'; ELSE GENDER = 'Male'; PRESS = INT(RANNOR(0)*20 + 95 + 50*(GENDER EQ 'Male')); CURL = RANNOR(0)*10 + 30 + .2*PRESS; PUSHUPS = INT(RANNOR(0)*3 + 5 + 5*(GENDER EQ 'Male') + .1*CURL); SITUPS = INT(RANNOR(0)*10 + 20 + .1*PRESS + PUSHUPS); OUTPUT; END; RUN; PROC PRINT DATA=EXERCISE; VAR GENDER; RUN; Obs GENDER 1 Male 2 Female 3 Female 4 Male 5 Male ............. ............... 496 Male 497 Female 498 Female 499 Male 500 Female PROC CORR DATA=EXERCISE NOSIMPLE; VAR PRESS CURL PUSHUPS SITUPS; RUN; The CORR Procedure 4 Variables: PRESS CURL PUSHUPS SITUPS Pearson Correlation Coefficients, N = 500 Prob > |r| under H0: Rho=0 PRESS CURL PUSHUPS SITUPS PRESS 1.00000 0.57080 0.61999 0.45234 <.0001 <.0001 <.0001 CURL 0.57080 1.00000 0.53702 0.34020 <.0001 <.0001 <.0001 PUSHUPS 0.61999 0.53702 1.00000 0.50768 <.0001 <.0001 <.0001 SITUPS 0.45234 0.34020 0.50768 1.00000 <.0001 <.0001 <.0001 DATA NEW; SET EXERCISE; IF GENDER = 'Male' THEN MALE = 1; ELSE IF GENDER = 'Female' THEN MALE = 0; RUN; NOTE: SET reads observations from EXERCISE to form a new data set NEW. In this way we have created a new data set with DUMMY variable MALE taking the values 0 and 1. FEMALE is the reference. PROC PRINT DATA=NEW; VAR MALE; RUN; Obs MALE 1 1 2 0 3 0 4 1 5 1 .............. .............. 496 1 497 0 498 0 499 1 500 0 PROC REG DATA=NEW; TITLE "Stepwise Multiple Regression"; MODEL PRESS = MALE CURL PUSHUPS SITUPS / SELECTION = STEPWISE; RUN; QUIT; Stepwise Multiple Regression The REG Procedure Model: MODEL1 Dependent Variable: PRESS Number of Observations Read 500 Number of Observations Used 500 Stepwise Selection: Step 1 Variable MALE Entered: R-Square = 0.5706 and C(p) = 120.4358 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 1 270218 270218 661.64 <.0001 Error 498 203386 408.40606 Corrected Total 499 473604 Parameter Standard Variable Estimate Error Type II SS F Value Pr > F Intercept 96.34586 1.23910 2469152 6045.83 <.0001 MALE 46.59003 1.81127 270218 661.64 <.0001 Bounds on condition number: 1, 1 ---------------------------------------------------------------------- Stepwise Selection: Step 2 Stepwise Multiple Regression The REG Procedure Model: MODEL1 Dependent Variable: PRESS Stepwise Selection: Step 2 Variable CURL Entered: R-Square = 0.6447 and C(p) = 15.9936 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 2 305337 152668 450.93 <.0001 Error 497 168267 338.56492 Corrected Total 499 473604 Parameter Standard Variable Estimate Error Type II SS F Value Pr > F Intercept 59.08881 3.82812 80664 238.25 <.0001 MALE 38.58506 1.82686 151033 446.10 <.0001 CURL 0.76944 0.07555 35119 103.73 <.0001 Bounds on condition number: 1.2271, 4.9086 ---------------------------------------------------------------------- Stepwise Selection: Step 3 Stepwise Multiple Regression The REG Procedure Model: MODEL1 Dependent Variable: PRESS Stepwise Selection: Step 3 Variable SITUPS Entered: R-Square = 0.6551 and C(p) = 3.0481 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 3 310268 103423 314.06 <.0001 Error 496 163336 329.30579 Corrected Total 499 473604 Parameter Standard Variable Estimate Error Type II SS F Value Pr > F Intercept 49.63076 4.49752 40101 121.77 <.0001 MALE 36.27409 1.89810 120269 365.22 <.0001 CURL 0.71136 0.07600 28847 87.60 <.0001 SITUPS 0.31231 0.08071 4931.09072 14.97 0.0001 Bounds on condition number: 1.362, 11.682 ---------------------------------------------------------------------- All variables left in the model are significant at the 0.1500 level. No other variable met the 0.1500 significance level for entry into the model. Stepwise Multiple Regression The REG Procedure Model: MODEL1 Dependent Variable: PRESS Summary of Stepwise Selection Variable Variable Number Partial Model Step Entered Removed Vars In R-Square R-Square C(p) F Value 1 MALE 1 0.5706 0.5706 120.436 661.64 2 CURL 2 0.0742 0.6447 15.9936 103.73 3 SITUPS 3 0.0104 0.6551 3.0481 14.97 Summary of Stepwise Selection Step Pr > F 1 <.0001 2 <.0001 3 0.0001