I run the ANOVA Procedure using SAS Studio (SAS University Edition) for the data from a split-plot experiment (see attached sas file). From page 3 onwards of the attached results file, one can see the output of the Means Procedure.
I cannot find:
Your advice will be appreciated.
Armando
Thank you so much @PaigeMiller ! You have been very helpful!
I will look into using the LSMEANS statement.
As I no longer am willing to download files from this web site, please paste your code as text into your message using the "running man" icon and please paste the output into your message as a screen capture(s), using the "Insert Photos" icon.
data sp;
input Block cal K rend @@;
datalines;
1 0 0 1949
2 0 0 1955
3 0 0 1874
1 0 90 2385
2 0 90 2319
3 0 90 2339
1 0 180 5042
2 0 180 4866
3 0 180 4778
1 2 0 7529
2 2 0 7694
3 2 0 6863
1 2 90 .
2 2 90 8484
3 2 90 7410
1 2 180 .
2 2 180 .
3 2 180 7779
;
proc anova data=sp;
class cal K Block;
model rend = cal K cal*K Block cal*Block;
test h=cal e=cal*Block;
means cal K cal*K / lsd;
run;
I agree with @PaigeMiller in requesting you actually insert the code in the sas code popup produced by the running man. Please encourage us to help you by not obligating us to download something that this web site makes easy for you to post.
Thanks for posting the code. I looked up the documentation for the means statement in proc anova, and couldn't see why you didn't get the one-way means. I would expect them too.
But dropping the "/ lsd" option gave the desired means, but then dropped the pairwise t tests.
However, I did produce what I think you want by entering two MEANS statements, one with the /lsd and one without:
proc anova data=sp;
class cal K Block;
model rend = cal K cal*K Block cal*Block;
test h=cal e=cal*Block;
means cal K cal*K ;
means cal K cal*K / lsd ;
run;
quit;
Thank you for your input that helped me obtain the three K means.
However, I am missing the following:
First, you need to be aware of the limitation of PROC ANOVA. The documentation says:
Use PROC ANOVA for the analysis of balanced data only, with the following exceptions: one-way analysis of variance, Latin square designs, certain partially balanced incomplete block designs, completely nested (hierarchical) designs, and designs with cell frequencies that are proportional to each other and are also proportional to the background population. These exceptions have designs in which the factors are all orthogonal to each other.
So, I don't think you should use this PROC for your data, as I'm pretty sure it is giving questionable results. You want to use PROC GLM.
Your PROC ANOVA, which may be producing the wrong answers, does provide tables of means as you requested, sometimes in the form of an LSD chart (which is what you requested). If you add in the LINES or LINESTABLE option, you will see them more clearly. If you don't want the graphical comparisons of means and just want them in a table, use the command ODS GRAPHICS OFF; before you run PROC GLM.
Thank you for your help. I have made progress, and now I'm missing only the LSD values to compare the means shown in the last table (page 7 of the output), which corresponds to the cal * K interaction effects. Since the data came from a split-plot design, different error terms must be used, depending on the comparisons of interest. I don't know why I am not getting this part of the results.
I don't think the MEANS statement gives LSD tests for interactions.
You can compare the interactions using the LSMEANS statement and the LINES option.
Thank you so much @PaigeMiller ! You have been very helpful!
I will look into using the LSMEANS statement.
I will go even farther than @PaigeMiller , and suggest you use PROC MIXED as you have a randomized complete block design. This procedure will treat the blocks as random effects, which will help with any inferences you have beyond the blocks included in your study. The lsmeans should not be different, but the GLM analysis leads to a narrow inference space (what you would expect to happen if you repeated the experiment many times on exactly the same blocks), while the MIXED analysis leads to a broad inference space (what you would expect to happen you repeated the experiment many times on blocks sampled from all possible blocks). Try this code:
proc mixed data=sp;
class cal K Block;
model rend = cal K cal*K;
random block;
lsmeans cal K cal*K/diff ;
run;
SteveDenham
Thank you very much for providing further and valuable advice.
I used the code that you suggested with a the addition of the cal*Block effect in the random statement, to account for the split-plot design.
I am going to compare the outputs, but I could immediately see that the means comparisons differ. Apparently, LSDs cannot be estimated with Proc MIXED.
proc mixed data=sp;
class cal K Block;
model rend = cal K cal*K;
random block cal*Block;
lsmeans cal K cal*K/diff ;
run;
I take your statement to mean that MIXED does not report an LSD value. The issue is that since there are two sources of variability, the classical LSD value is difficult to calculate. And it isn't really needed - the diff option to the LSMEANS statement provides the equivalent of a t test between the least squares means in question. That is exactly what an LSD does. If you need a calculated LSD, look at the t value reported for (EDIT: the difference between) any two means, and rearrange the following equation to solve for t(df,0.95).
pdiff = CDF('T',calculated t value, df) to
t(df,0.95 two tailed) = QUANTILE ('T",0.975, df).
Once you have t(df, 0.95 two tailed) the LSD is t(df, 0.95 two tailed) * std error of the difference. The std error of the difference should be presented in the table of lsmean differences, so it is just a simple multiplication to get a calculated LSD.
SteveDenham
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.