/********************* cars3.sas ***************************/ title 'Metric Cars Data with proc glm'; /* Read data from Excel spreadsheet */ proc import datafile="/folders/myfolders/441s18/Lecture/mcars4.xlsx" out=cars dbms=xlsx replace; getnames=yes; data automobile; set cars; Country = Cntry; label Country = 'Location of Head Office' lper100k = 'Litres per 100 kilometers' weight = 'Weight in kg' length = 'Length in meters'; ods exclude MeanPlot (persist) DiffPlot (persist); /* Suppressing the proc glm plots */ proc glm data = automobile; title2 'Analysis of Covariance'; class Country; model lper100k = weight length country; lsmeans country / pdiff tdiff adjust=bon; run; /* The following produces results that are difficult to interpret. The * notation is good for for interactions between factors, but proc reg is better for interactions between factors and covariates. */ proc glm data = automobile noprint; title2 'With Interactions'; class Country; model lper100k = weight length country weight*country length*country; lsmeans country / pdiff tdiff; /* Unadjusted, for comparison. */ run;