* SAS LAB 8; * Solution to the Exercise; PROC IMPORT Out=S3A3.Batteries Datafile="Data\Batteries.txt" DBMS=DLM REPLACE; Getnames=YES; Datarow=2; run; * For each part I will use both GLM and REG; * Note that the reference category may be different for the two fits; * (a); PROC GLM Data=S3A3.Batteries; Class Brand Device; Model Life=Brand /solution; run; Data S3A3.Batteries1; Set S3A3.Batteries; If Brand='A' then Brand1=0; else Brand1=1; run; PROC REG Data=S3A3.Batteries1 plots=none; Model Life=Brand1; run; * (b); PROC GLM Data=S3A3.Batteries plots=none; Class Brand Device; Model Life=Brand Device/solution; run; Data S3A3.Batteries1; Set S3A3.Batteries1; If Device='Radio' then Radio=1; else Radio=0; If Device='DVD' then DVD=1; else DVD=0; If Device='Camera' then Camera=1; else Camera=0; run; PROC REG Data=S3A3.Batteries1 plots=none; * In this case I will use Radio as the reference category of Device; Model Life=Brand1 DVD Camera; run; * (c); PROC GLM Data=S3A3.Batteries plots=none; Class Brand Device; Model Life=Brand Device Brand*Device/solution; run; Data S3A3.Batteries1; Set S3A3.Batteries1; Radio_B=Radio*Brand1; DVD_B=DVD*Brand1; Camera_B=Camera*Brand1; run; PROC REG Data=S3A3.Batteries1 plots=none; * In this case I will use Radio as the reference category of Device; Model Life=Brand1 DVD Camera DVD_B Camera_B; run;