Hello everyone,
My data contains milk production parameters as the variables are: Milk, Fat, and Protein in the row of the excel file and the breed of the animal (1, 2) and the month (1,2,3,4 ) in the column.
so, for each month and each breed, we have the milk production parameters (milk, fat, and protein).
I want to see the effect of breed, month, and their interaction on these parameters (milk, fat, and protein).
I wonder about the glm procedure:
proc glm ;
model Milk Fat Protein= breed month breed * month ;
but I was asked to do the two-way ANOVA analysis and I wrote this code:
proc univariate data=milk ;
var Milk Fat Protein ;
run;
Is the code for the two-way ANOVA correct to see the effect of the breed the month and their interaction?
What is the difference between the proc glm and univariate if they can do the same test?
Thank you! and I am sorry for my lack of knowledge.
I don't see anything that Proc Univariate code doing any ANOVA. It gives summary statistics of three variables and does not use the Breed or Month at all. So I don't quite understand why you are asking about comparison between Univariate and GLM at all.
@always-good wrote:
Hello everyone,
My data contains milk production parameters as the variables are: Milk, Fat, and Protein in the row of the excel file and the breed of the animal (1, 2) and the month (1,2,3,4 ) in the column.
so, for each month and each breed, we have the milk production parameters (milk, fat, and protein).
I want to see the effect of breed, month, and their interaction on these parameters (milk, fat, and protein).
I wonder about the glm procedure:
proc glm ;
model Milk Fat Protein= breed month breed * month ;
but I was asked to do the two-way ANOVA analysis and I wrote this code:
proc univariate data=milk ;
var Milk Fat Protein ;
run;Is the code for the two-way ANOVA correct to see the effect of the breed the month and their interaction?
What is the difference between the proc glm and univariate if they can do the same test?
Thank you! and I am sorry for my lack of knowledge.
PROC ANOVA would be a good guess.
https://www.stat.purdue.edu/~tqin/system101/method/method_two_way_ANOVA_sas.htm
Do not use PROC ANOVA for two-way ANOVA unless the cell sizes are all equal.
From the documentation for PROC ANOVA
The ANOVA procedure is designed to handle balanced data (that is, data with equal numbers of observations for every combination of the classification factors)
proc glm ;
model Milk Fat Protein= breed month breed * month ;
This looks like a two-way ANOVA to me.
Please, from now on @always-good, please use a code box to include actual code in your message. The above code box is created by clicking on the "little running man" icon and pasting your code into the window that appears.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.