The objective of this script is to analyze the effects of different factors on the yield (Y) of sugar beets. The data is structured according to a latin square split-plot design, with factors 'Harvest', 'Rep' (repetition), 'Column', and 'Variety'. The DATA STEP block generates observations from 'datalines' to construct the 'Beets' dataset. Then, PROC ANOVA is used to model the yield based on these factors and to perform specific tests on the effects of the factors Harvest, Rep, Column, and Variety, using appropriate error terms for the experimental design.
Data Analysis
Type : CREATION_INTERNE
The data for the 'Beets' dataset is directly created and populated within the SAS script via a DATALINES block. It represents the results of an experiment with a latin square split-plot design, measuring the yield of different sugar beet varieties over two harvests.
1 Code Block
DATA STEP Data
Explanation : This DATA STEP block is responsible for creating the 'Beets' dataset. It uses nested 'do' loops to generate the variables 'Harvest' (1 to 2), 'Rep' (1 to 6), and 'Column' (1 to 6). The 'Variety' variable and the dependent variable 'Y' (yield) are read sequentially from the DATALINES block. The ' @code_sas/16.4'.sas instruction at the end of 'input' keeps the pointer on the same data line until all observations for a combination of Harvest, Rep, and Column are read, which is typical for experimental designs where multiple measurements are on the same physical data line. The 'title1' and 'title3' statements define the SAS output titles.
Explanation : This block uses the PROC ANOVA procedure to perform the analysis of variance on the 'Beets' dataset. The 'class' statement declares the categorical variables (factors) 'Column', 'Rep', 'Variety', and 'Harvest'. The 'model' statement specifies the linear model, where 'Y' is the dependent variable and the other variables are the factors and their interactions. The 'test' statements are used to specify the appropriate error terms for hypothesis testing. For example, 'test h=Rep Column Variety e=Rep*Column*Variety' indicates that the effect of 'Rep', 'Column', and 'Variety' should be tested against the 'Rep*Column*Variety' error, which is common in split-plot and latin square designs for whole-plot effects. Similarly, 'test h=Harvest e=Harvest*Rep' tests the effect of 'Harvest' against its interaction with 'Rep'.
Copied!
proc anova data=Beets;
class Column Rep Variety Harvest;
model Y=Rep Column Variety Rep*Column*Variety
Harvest Harvest*Rep
Harvest*Variety;
test h=Rep Column Variety e=Rep*Column*Variety;
test h=Harvest e=Harvest*Rep;
run;
1
PROC ANOVADATA=Beets;
2
class Column Rep Variety Harvest;
3
model Y=Rep Column Variety Rep*Column*Variety
4
Harvest Harvest*Rep
5
Harvest*Variety;
6
test h=Rep Column Variety e=Rep*Column*Variety;
7
test h=Harvest e=Harvest*Rep;
8
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.