Hello,
I wrote code to perform a post hoc pairwise comparison on my dataset called garlic. I view the answers and edited my code to correct any errors and warnings to match with the code found on the solution. After executing the program, I have one warning and one error. The warning states "
78 proc glm data=stat1.garlic; 79 plots(only)=(diffplot(center)controlplot); _____ 180 NOTE: The previous statement has been deleted. ERROR 180-322: Statement is not valid or it is used out of proper order.
The log is telling you that something is wrong with the PLOTS statement where it is. In fact, there is no PLOTS statement in PROC GLM.
Why does PROC GLM not recognize the PLOTS option of the PROC GLM statement, and think it is a separate statement? Because you have ended the PROC GLM statement with a semicolon. If you remove the semicolon, then PLOTS becomes part of the PROC GLM statement where it is a valid option.
Many of us will not download attachments.
Please copy and paste the log from the SAS log window (do not copy from your MS Word document) and paste it here after clicking on the </> icon. Please show us the ENITRE log for this PROC. Do not chop out parts of the log
Sure @PaigeMiller ,
Here is the log from SAS Studio,
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
NOTE: ODS statements in the SAS Studio environment may disable some output features.
73
74 *Practice: Using PROC GLM to Perform Post Hoc Pairwise Comparisons
75 1);
76 ods graphics;
77 ods select lsmeans diff diffplot controlplot;
78 proc glm data=stat1.garlic;
79 plots(only)=(diffplot(center)controlplot);
_____
180
NOTE: The previous statement has been deleted.
ERROR 180-322: Statement is not valid or it is used out of proper order.
80 class fertilizer;
81 model Bulbwt=Fertilizer;
82 Tukey: lsmeans Fertilizer / pdiff=all adjust=tukey;
83 title "Post-Hoc Analysis of ANOVA---Fertilizer as Predictor";
84 run;
85 quit;
WARNING: Output 'controlplot' was not created. Make sure that the output object name, label, or path is spelled correctly. Also,
verify that the appropriate procedure options are used to produce the requested output object. For example, verify that
the NOPRINT option is not used.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GLM used (Total process time):
real time 4.90 seconds
cpu time 0.26 seconds
86 title;
87
88
89 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
101
Let me know if I need to do anything else.
Thanks.
78 proc glm data=stat1.garlic; 79 plots(only)=(diffplot(center)controlplot); _____ 180 NOTE: The previous statement has been deleted. ERROR 180-322: Statement is not valid or it is used out of proper order.
The log is telling you that something is wrong with the PLOTS statement where it is. In fact, there is no PLOTS statement in PROC GLM.
Why does PROC GLM not recognize the PLOTS option of the PROC GLM statement, and think it is a separate statement? Because you have ended the PROC GLM statement with a semicolon. If you remove the semicolon, then PLOTS becomes part of the PROC GLM statement where it is a valid option.
@Matim wrote:
Hello,
I wrote code to perform a post hoc pairwise comparison on my dataset called garlic. I view the answers and edited my code to correct any errors and warnings to match with the code found on the solution. After executing the program, I have one warning and one error. The warning states "
Output 'control plot' was not created. Make sure that the output object name, label, or path is spelled correctly. Also, verify that the appropriate procedure options are used to produce the requested output object. For example, verify that the NOPRINT option is not used." The error states "Statement is not valid or it is used out of proper order."? How can I resolve the warning and error messages?
The type of message relate to "Output 'control plot' was not created" has a few common issues. The one I make most often is using ODS OUTPUT with the incorrect name, the names typically do not have spaces in them so you might just need ControlPlot instead of "control plot". As the note mentioned the procedure may require a specific option to be used on either a Proc statement or other statement. So make sure the options you used will create the object. Typically you can search the documentation under the Details tab for "ODS Graphics" or "ODS Table Names" to find the proper name and the required options.
Hello, @Matim
Show me the log where you have made the change I described. I can't diagnose your code from written paragraphs.
Sure @PaigeMiller ,
Here is the log with the changes I have made thus far from your advice.
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
NOTE: ODS statements in the SAS Studio environment may disable some output features.
73
74 *Practice: Using PROC GLM to Perform Post Hoc Pairwise Comparisons
75 1);
76 ods graphics;
77 ods select lsmeans diff diffplot ControlPlot;
78 proc glm data=stat1.garlic
79 plots(only)=(diffplot(center) ControlPlot);
80 class fertilizer;
81 model Bulbwt=Fertilizer;
82 Tukey: lsmeans Fertilizer / pdiff=all adjust=tukey;
83 title "Post-Hoc Analysis of ANOVA---Fertilizer as Predictor";
84 run;
85 quit;
WARNING: Output 'ControlPlot' was not created. Make sure that the output object name, label, or path is spelled correctly. Also,
verify that the appropriate procedure options are used to produce the requested output object. For example, verify that
the NOPRINT option is not used.
NOTE: PROCEDURE GLM used (Total process time):
real time 0.51 seconds
cpu time 0.23 seconds
86 title;
87
88
89 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
101
You might want to bookmark this part of the SAS documentation, if you are going to be doing more plotting from PROC GLM.
It says clearly you must use the option PDIFF=CONTROL in the LSMEANS statement to get the CONTROLPLOT output.
Hi @PaigeMiller ,
So, I tried to apply the statement of LSMEANS/PDIFF=CONTROL and I got 2 errors as the result. Here is the log for the code.
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
NOTE: ODS statements in the SAS Studio environment may disable some output features.
73
74 ods graphics;
75
76 ods select lsmeans / pdiff=control;
_
22
200
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, ;, #, (, '.', /, WHERE, \.
ERROR 200-322: The symbol is not recognized and will be ignored.
77 proc glm data=stat1.garlic
78 plots(only)=(diffplot(center) controlplot);
79 class fertilizer;
80 model Bulbwt=Fertilizer;
81 Tukey: lsmeans Fertilizer / pdiff=all adjust=tukey;
82 title "Post-Hoc Analysis of ANOVA---Fertilizer as Predictor";
83 run;
84 quit;
NOTE: PROCEDURE GLM used (Total process time):
real time 0.61 seconds
cpu time 0.29 seconds
85 title;
86
87
88 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
100
In the original code where I had one warning, I seeked the solution to the exercise and the solution shows the exact coding where I originally had one warning and zero errors. I copied the solution to my programming interface and ran the code. I still got the same warning message. Am I not applying the reference code correctly?
Thanks
Mat.
PDIFF=CONTROL is supposed to go in the LSMEANS statement and not the ODS statement.
Alright,
I removed the pdiff=control from the ods statement and placed it in the lsmeans statement under proc glm based on the reference table. I now end up with more warnings and one error. How did I get more warnings that now state 'diff','diffplot', and 'lsmeans' were not created? I also got an error stating 'a Model Statement' must be created'. Here is the log again.
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; NOTE: ODS statements in the SAS Studio environment may disable some output features. 73 74 ods graphics; 75 ods select lsmeans diff diffplot controlplot; 76 proc glm data=stat1.garlic 77 plots(only)=(diffplot(center) controlplot); 78 lsmeans/pdiff=control; 79 lsmeans/pdiff; 80 class fertilizer; 81 model Bulbwt=Fertilizer; 82 Tukey: lsmeans Fertilizer / pdiff=all adjust=tukey; 83 title "Post-Hoc Analysis of ANOVA---Fertilizer as Predictor"; 84 run; ERROR: A MODEL statement must be given. NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE GLM used (Total process time): real time 0.00 seconds cpu time 0.00 seconds WARNING: Output 'controlplot' was not created. Make sure that the output object name, label, or path is spelled correctly. Also, verify that the appropriate procedure options are used to produce the requested output object. For example, verify that the NOPRINT option is not used. WARNING: Output 'diffplot' was not created. Make sure that the output object name, label, or path is spelled correctly. Also, verify that the appropriate procedure options are used to produce the requested output object. For example, verify that the NOPRINT option is not used. WARNING: Output 'diff' was not created. Make sure that the output object name, label, or path is spelled correctly. Also, verify that the appropriate procedure options are used to produce the requested output object. For example, verify that the NOPRINT option is not used. WARNING: Output 'lsmeans' was not created. Make sure that the output object name, label, or path is spelled correctly. Also, verify that the appropriate procedure options are used to produce the requested output object. For example, verify that the NOPRINT option is not used. 85 quit; 86 title; 87 88 89 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 101
You might want to bookmark the PROC GLM documentation and refer to it as needed.
The LSMEANS statements must come AFTER the model statement.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.