# SAS One Way ANOVA – SAS PROC ANOVA

We looked at SASÂ T-testÂ in the previous tutorial, today we will be looking at a similar statistical procedure called SAS ANOVA (analysis of variance) and how it is used in SAS Programming for comparing means across multiple samples.

Our focus here will be to understand SAS One Way ANOVA with example and SAS PROC ANOVA Procedure.

Let’s start SAS One Way ANOVA and SAS PROC ANOVA.

## What is SAS ANOVA

Analysis of Variance (ANOVA) in SAS Programming Language is used for comparing means of different groups but based on a concept of “Sources of Variance”. Â It has 3 Variances – Overall Variance, Variance due to Groups, and Variance within Groups.

Variance for a sample data is calculated using formula

The formula of SAS ANOVA

Some of the key assumptions in SAS ANOVA analysis are-

• Independence-Â Observations are independent of each other.
• Normality-Â Values follow normal distribution within each group (marriage age for each region).
• Homogeneity of Variances-Â  Variance for the data is same or similar in all the groups/regions.

## SAS PROC ANOVA Procedure

SAS Programming has a procedure called SAS PROC ANOVA which allows us to perform Analysis of Variance. First of all, we need to read the data and then use this procedure.

SAS PROC ANOVA procedure has two statements, a CLASS statement to give a name of a categorical variable. And MODEL statement helps us to give a structure of model or analysis.

Syntax-

```PROC ANOVA dataset;
CLASS Variable;
MODEL Variable1=variable2;
MEANS;```

Here variable1 and variable2 are targets and independent variables respectively.

## SAS One Way ANOVA

Let us consider the dataset marriage. Here we study the dependence between theÂ variables age and region. In the below SAS One Way ANOVA example, marriage age is target variable and region as independent.

SAS One Way ANOVA Example-

```data marriage;
Â Â Â Â Â Â Â Â Â Â Â  input region \$ age;
cards;
SÂ Â Â Â Â Â Â Â Â  27
SÂ Â Â Â Â Â Â Â Â  22
SÂ Â Â Â Â Â Â Â Â  22
SÂ Â Â Â Â Â Â Â Â  24
NÂ Â Â Â Â Â Â    24
NÂ Â Â Â Â Â Â  Â  27
NÂ Â Â Â Â Â Â  Â  28
NÂ Â Â Â Â Â Â  Â  30
EÂ Â Â Â Â Â Â Â Â  33
EÂ Â Â Â Â Â Â Â Â  29
EÂ Â Â Â Â Â Â Â Â  30
EÂ Â Â Â Â Â Â Â Â  27
WÂ Â Â Â Â  Â Â   34
WÂ Â Â Â Â Â Â    35
WÂ Â Â Â Â Â  Â   37
WÂ Â Â Â Â Â  Â   29
;
run;Â
%* ANOVA using SAS;Â
proc anova data=marriage;
Â class region;
Â MODELÂ Â age =region;
run;```

SAS One Way ANOVA Example

We can also seeÂ SAS Box Plot which we get in SAS output. This gives a visualization of the data.

SAS One Way ANOVA – Box Plot

This was all about SAS ANOVA Tutorial. Hope you like our explanation of SAS One Way ANOVA & SAS Proc ANOVA analysis.

## Conclusion

Hence, we hope you all understood what is SAS ANOVA and how it can be used, we also looked at SAS One Way ANOVA. In conclusion, we saw SAS Proc ANOVA with SAS One Way ANOVA example.

Furthermore, if you have any query feel free to ask in a comment section and stay tuned to learn more interesting things in SAS.

Did you like our efforts? If Yes, please give DataFlair 5 Stars on Google

DataFlair Team

The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.

### 2 Responses

1. Iy says:

Can you plesase intrepret out put. And do couple examples to cover different interpretation scenarios

• Iy says:

For all tutorial posts