data cars; infile 'C:\week8\mileagesas.TXT'; input auto miles displ hpw torque compr rearaxle carb speeds length width weight trans $; transm=1; if trans="M" then transm=0; drop auto; label miles="Gas mileage (miles/gallon)" displ="motor displacement (cubic in)" hpw="horse power (ft-lb)" torque="Torque (ft-lb)" compr="Compression ratio" rearaxle="Rear axle ratio" carb="Carburetor (barrels)" speeds="No. of transmission speeds" length="Overall length (in)" width="Width (in)" weight="Weight (lbs)" transm="Type of transmission (1-automatic, 2=manual)"; /* Compute the correlation among the variables*/ proc corr; run; /* Produce the scatter plots of miles vs x-variables*/ proc gplot; plot miles*(displ rearaxle length width); run; /* Run model selection methods - each MODEL statement corresponds to a particular model selection procedure. In the REG procedure, we can use several MODEL statements*/ proc reg; model miles=displ hpw torque compr rearaxle carb speeds length width weight transm/ selection=stepwise sle=0.1 sls=0.1; model miles=displ hpw torque compr rearaxle carb speeds length width weight transm/ selection=backward; model miles=displ hpw torque compr rearaxle carb speeds length width weight transm/ selection=adjrsq cp adjrsq; run;quit; /* Estimate the two regression models selected by the procedures above*/ symbol value=dot; proc reg; model miles=rearaxle length weight; plot student.*(predicted. rearaxle length weight)/symbol="dot"; plot npp.*student./symbol="dot"; model miles=displ; plot student.*predicted./symbol="dot"; plot npp.*student./symbol="dot"; plot miles*displ; run; quit;