1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
NOTE: ODS statements in the SAS Studio environment may disable some output features.
56
57 /********************** kars.sas **************************/
58 title 'Metric Cars Data Example';
59 title2 'Jerry Brunner: Student Number 999999999';
60
61 data auto;
62 infile '/folders/myfolders/431s17/mcars4.data.txt' firstobs=2 ; /* Skipping the header on line 1 */
63 input id country $ lper100k weight length;
64 mpg = 100/lper100k * 0.6214/0.2642;
65 /* Indicator dummy vars: Ref category is Japanese */
66 if country = 'US' then c1=1;
67 else if country = 'Japan' then c1=0;
68 else if country = 'Europ' then c1=0;
69 if country = 'Europ' then c2=1;
70 else if country = 'US' then c2=0;
71 else if country = 'Japan' then c2=0;
72 /* Product terms for the interactions */
73 wc1 = weight*c1; wc2 = weight*c2;
74 Lc1 = length*c1; Lc2 = length*c2;
75 label country = 'Country of Origin'
76 lper100k = 'Litres per 100 Kilometers'
77 weight = 'Weight in kg'
78 length = 'Length in cm'
79 mpg = 'Miles per gallon';
80
NOTE: The infile '/folders/myfolders/431s17/mcars4.data.txt' is:
Filename=/folders/myfolders/431s17/mcars4.data.txt,
Owner Name=root,Group Name=vboxsf,
Access Permission=-rwxrwx---,
Last Modified=18Jan2015:19:30:16,
File Size (bytes)=4160
NOTE: 100 records were read from the infile '/folders/myfolders/431s17/mcars4.data.txt'.
The minimum record length was 40.
The maximum record length was 40.
NOTE: The data set WORK.AUTO has 100 observations and 12 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
81 proc freq;
82 title3 'Frequency Distributions';
83 tables country c1 c2 ;
NOTE: There were 100 observations read from the data set WORK.AUTO.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.06 seconds
cpu time 0.07 seconds
84 proc means;
85 title3 'Means and standard deviations by country';
86 class country;
87 var lper100k mpg weight length;
88
NOTE: There were 100 observations read from the data set WORK.AUTO.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.07 seconds
cpu time 0.06 seconds
89 proc corr;
90 title3 'Correlation matrix';
91 var lper100k mpg weight length;
92
93 ods graphics off; /* Suppress diagnostic plots */
NOTE: PROCEDURE CORR used (Total process time):
real time 0.07 seconds
cpu time 0.05 seconds
94 proc reg;
95 title3 'Regression model with non-parallel planes';
96 model lper100k = weight length c1 c2 wc1 wc2 Lc1 Lc2;
97 EqualSlopes: test wc1 = wc2 = Lc1 = Lc2 = 0;
98
NOTE: PROCEDURE REG used (Total process time):
real time 0.09 seconds
cpu time 0.08 seconds
99 proc reg;
100 title3 'Parallel planes';
101 model lper100k = weight length c1 c2;
102 USvsEURO: test c1=c2; /* US vs European controlling for weight and length */
103 country: test c1 = c2 = 0;
104
105
106 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
118