1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
NOTE: ODS statements in the SAS Studio environment may disable some output features.
73
74 /********************* cars3.sas ***************************/
75 title 'Metric Cars Data with proc glm';
76
77 /* Read data from Excel spreadsheet */
78 proc import datafile="/folders/myfolders/441s18/Lecture/mcars4.xlsx"
79 out=cars dbms=xlsx replace;
80 getnames=yes;
81
NOTE: One or more variables were converted because the data type is not supported by the V9 engine. For more details, run with
options MSGLEVEL=I.
NOTE: The import data set has 100 observations and 4 variables.
NOTE: WORK.CARS data set was successfully created.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.03 seconds
cpu time 0.02 seconds
82 data automobile;
83 set cars;
84 Country = Cntry;
85 label Country = 'Location of Head Office'
86 lper100k = 'Litres per 100 kilometers'
87 weight = 'Weight in kg'
88 length = 'Length in meters';
89
90 ods exclude MeanPlot (persist) DiffPlot (persist);
91 /* Suppressing the proc glm plots */
92
NOTE: There were 100 observations read from the data set WORK.CARS.
NOTE: The data set WORK.AUTOMOBILE has 100 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds
93 proc glm data = automobile;
94 title2 'Analysis of Covariance';
95 class Country;
96 model lper100k = weight length country;
97 lsmeans country / pdiff tdiff adjust=bon;
98 run;
99
100 /* The following produces results that are difficult to interpret.
101 The * notation is good for for interactions between factors,
102 but proc reg is better for interactions between factors and
103 covariates. */
104
NOTE: PROCEDURE GLM used (Total process time):
real time 0.21 seconds
cpu time 0.21 seconds
105 proc glm data = automobile noprint;
106 title2 'With Interactions';
107 class Country;
108 model lper100k = weight length country
109 weight*country length*country;
110 lsmeans country / pdiff tdiff; /* Unadjusted, for comparison. */
111 run;
112
113
114
115
116
117
118
119
120
121 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
134