The script initializes a dataset named 'Barley' using inline data (datalines), simulating a four-replicate strip-split plot experiment. The factors studied are Replication (Rep), Soil Type (Soil, 3 levels), Fertilizer Type (Fertilizer, 4 levels), and the presence/absence of Calcium (Calcium, 2 levels). The PROC ANOVA procedure is then used to model the yield ('Yield') as a function of these factors, including appropriate interactions and replication terms for a strip-split plot analysis. Several specific hypothesis tests are defined to evaluate the effects of the different factors and their interactions, using the correct error terms. Finally, means for different factor combinations are calculated and displayed.
Data Analysis
Type : CREATION_INTERNE
The 'Barley' dataset is created directly within the SAS script using a DATA step and the DATALINES statement. The data represents yields measured for various combinations of replications, soil types, fertilizer types, and calcium levels, structured for a strip-split plot experimental design.
1 Code Block
DATA STEP Data
Explanation : This block uses a DATA step to create the 'Barley' dataset. It generates an experimental design by looping through the variables Rep (replication), Soil, Fertilizer, and Calcium. The `input Yield @;` statement sequentially reads yield values from the DATALINES statement, and the `output;` statement writes an observation for each factor combination. The title 'Strip-split Plot' is added to the SAS output.
Explanation : This block executes a univariate analysis of variance using the PROC ANOVA procedure on the 'Barley' dataset. The `CLASS` statement identifies categorical variables (Rep, Soil, Calcium, Fertilizer). The `MODEL` statement specifies the linear model for the dependent variable 'Yield' as a function of main effects, interactions, and replication error terms, structured for a strip-split plot design. Several `TEST` statements perform specific hypothesis tests for the different effects (Fertilizer, Calcium, Soil, and their interactions) using the appropriate error terms for the factorial design. Finally, the `MEANS` statement calculates and displays the means for the specified factors and interactions (Fertilizer, Calcium, Soil, Calcium*Fertilizer).
Copied!
proc anova data=Barley;
class Rep Soil Calcium Fertilizer;
model Yield =
Rep
Fertilizer Fertilizer*Rep
Calcium Calcium*Fertilizer Calcium*Rep(Fertilizer)
Soil Soil*Rep
Soil*Fertilizer Soil*Rep*Fertilizer
Soil*Calcium Soil*Fertilizer*Calcium
Soil*Calcium*Rep(Fertilizer);
test h=Fertilizer e=Fertilizer*Rep;
test h=Calcium calcium*fertilizer e=Calcium*Rep(Fertilizer);
test h=Soil e=Soil*Rep;
test h=Soil*Fertilizer e=Soil*Rep*Fertilizer;
test h=Soil*Calcium
Soil*Fertilizer*Calcium e=Soil*Calcium*Rep(Fertilizer);
means Fertilizer Calcium Soil Calcium*Fertilizer;
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.
Copyright Info : S A S S A M P L E L I B R A R Y
NAME: ANOVAEX5
TITLE: Example 5 for PROC ANOVA
PRODUCT: STAT
SYSTEM: ALL
KEYS: analysis of variance, balanced data, design
PROCS: ANOVA
DATA:
REF: PROC ANOVA, EXAMPLE 5.
MISC:
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.