The script begins by creating a dataset named 'auto' containing variables for the manufacturer ('Make'), model ('Model'), and a reliability score ('Score'), with data provided directly in the script via datalines. Then, it sorts this dataset by 'Make' and 'Model'. Finally, the NESTED procedure is executed to perform a random-effects analysis of variance on the 'Score', using 'Make' and 'Model' as nested factors, allowing for the estimation of variance components associated with each classification level.
Data Analysis
Type : CREATION_INTERNE
The 'auto' dataset is created directly within the script from embedded data (datalines), without external dependencies or the use of SASHELP data.
1 Code Block
DATA STEP Data
Explanation : This DATA STEP block creates the 'auto' dataset. It defines three variables: 'Make' (character), 'Model' (numeric), and 'Score' (numeric). Data for these variables is provided directly in the script via the DATALINES statement, representing reliability scores for different car models.
Copied!
title1 'Reliability of Automobile Models';
data auto;
input Make $ Model Score;
datalines;
a 1 62 a 2 77 a 3 59
a 1 67 a 2 73 a 3 64
a 1 60 a 2 79 a 3 60
b 1 72 b 2 58 b 3 80
b 1 75 b 2 63 b 3 84
b 1 69 b 2 57 b 3 89
c 1 94 c 2 76 c 3 81
c 1 90 c 2 75 c 3 85
c 1 88 c 2 78 c 3 85
d 1 69 d 2 73 d 3 90
d 1 72 d 2 88 d 3 87
d 1 76 d 2 87 d 3 92
;
1
title1 'Reliability of Automobile Models';
2
DATA auto;
3
INPUT Make $ Model Score;
4
DATALINES;
5
a 162 a 277 a 359
6
a 167 a 273 a 364
7
a 160 a 279 a 360
8
b 172 b 258 b 380
9
b 175 b 263 b 384
10
b 169 b 257 b 389
11
c 194 c 276 c 381
12
c 190 c 275 c 385
13
c 188 c 278 c 385
14
d 169 d 273 d 390
15
d 172 d 288 d 387
16
d 176 d 287 d 392
17
;
2 Code Block
PROC SORT
Explanation : This block uses PROC SORT to sort the 'auto' dataset by the 'Make' and 'Model' variables. Sorting is a preparatory step for some analyses, although it is not always strictly mandatory for PROC NESTED.
Copied!
proc sort data=auto;
by Make Model;
run;
1
PROC SORTDATA=auto;
2
BY Make Model;
3
RUN;
3 Code Block
PROC NESTED
Explanation : This block executes PROC NESTED on the 'auto' dataset. It specifies 'Make' and 'Model' as classification variables, establishing a nested structure, and 'Score' as the analysis variable. This procedure is used to estimate variance components in a random-effects analysis of variance model.
Copied!
title1 'Reliability of Automobile Models';
proc nested data=auto;
class Make Model;
var Score;
run;
1
title1 'Reliability of Automobile Models';
2
PROC NESTEDDATA=auto;
3
class Make Model;
4
var Score;
5
RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.