03-30-2018 03:12 PM - edited 03-30-2018 03:15 PM
I'm having an issue with a program of mine. I'm just doing a simple ANOVA test on the mean weights of m&m's with respect to their colors to see if there is any significant differences in the means across the different colors (it's for a school assignment). I will post my code below:
DATA QUESTION5; INPUT @1 COLOR $ @8 WEIGHT; DATALINES; RED 0.946 RED 1.107 RED 0.913 RED 0.904 RED 0.926 RED 0.926 RED 1.006 RED 0.914 RED 0.922 RED 1.052 RED 0.903 RED 0.895 RED . RED . ORANGE 0.902 ORANGE 0.943 ORANGE 0.916 ORANGE 0.910 ORANGE 0.903 ORANGE 0.901 ORANGE 0.919 ORANGE 0.901 ORANGE 0.930 ORANGE 0.883 ORANGE . ORANGE . ORANGE . ORANGE . YELLOW 0.929 YELLOW 0.960 YELLOW 0.938 YELLOW 0.933 YELLOW 0.932 YELLOW 0.899 YELLOW 0.907 YELLOW 0.906 YELLOW 0.930 YELLOW 0.952 YELLOW 0.939 YELLOW 0.940 YELLOW 0.882 YELLOW 0.906 BROWN 0.896 BROWN 0.888 BROWN 0.906 BROWN 0.941 BROWN 0.838 BROWN 0.892 BROWN 0.905 BROWN 0.824 BROWN 0.908 BROWN 0.833 BROWN . BROWN . BROWN . BROWN . TAN 0.845 TAN 0.909 TAN 0.873 TAN 0.902 TAN 0.956 TAN 0.959 TAN 0.916 TAN 0.822 TAN . TAN . TAN . TAN . TAN . TAN . GREEN 0.935 GREEN 0.903 GREEN 0.865 GREEN 0.822 GREEN 0.871 GREEN 0.905 GREEN 0.905 GREEN 0.852 GREEN 0.965 GREEN 0.898 GREEN . GREEN . GREEN . GREEN . ; PROC GLM DATA = QUESTION5; CLASS COLOR; MODEL WEIGHT = COLOR; MEANS COLOR /TUKEY; MEANS COLOR; RUN;
Now the problem is, on my results page, which is attached as a PDF file, is showing the results as if I had told it to do a confidence interval estimate on all the means.
Basically, what I need the program to do, is show me the results of the Tukey test with the colored bars showing which means are significantly different. For example:
However, I do not understand why the code above will not do what I want it to, as I've talked to peers in my class and they don't see anything wrong with the code itself. Let me know what you think.
04-15-2018 11:57 AM
A version of this got it to work for me. All I had to do was:
PROC GLM DATA = QUESTION5;
MODEL WEIGHT = COLOR;
MEANS COLOR /TUKEY LINES;
When the cell sizes are unequal, which in my data set they are, SAS defaults to the CLDIFF option of the MEANS statement, unless you explicitly tell it to express significant mean differences with the LINES statement.
Thank you for the help.
03-30-2018 04:51 PM
Is the objective to draw a plot similar to the one you show?
Then you will have to tell us the components of that graph.
The plots in GLM are not going to give you something like that directly. You likely will have to create a data set and use a graphing procedure like Proc SGplot.
03-31-2018 07:15 AM
@Rick_SAS also wrote a blog about m&m's probability distribution with respect to their colors , Maybe he could give you a hint .
Need further help from the community? Please ask a new question.