I use proc glm, and glimmix mostly.
I like seeing the residual plots that I get from "plots=" statements in the procedure call.
With ods graphics on I get the residuals plots and I get a bar plot of differences from the multiple comparison procedure (MCP)
With ods graphics off I do not get the residuals plots but I get the results from the MCP as a compact letter display format.
Must I run the analysis twice to get the residuals plots and the MCP as a compact letter display?
I tried "ods graphics on" right before the "proc glm" statement and an "ods graphics off" right afterwards and that did not work.
Tim
PROC GLM is an interactive procedure, which means that you can use one PROC/RUN block to set up the model and analyze the data, and additional RUN blocks for further analysis. So you can turm ODS graphics ON and create the lines plot, then turn it OFF and get the table that contains the letters:
data wloss;
do diet = 'A','B','C','D','E';
do i = 1 to 10; input WeightLoss @@; output; end;
end;
datalines;
12.4 10.7 11.9 11.0 12.4 12.3 13.0 12.5 11.2 13.1
9.1 11.5 11.3 9.7 13.2 10.7 10.6 11.3 11.1 11.7
8.5 11.6 10.2 10.9 9.0 9.6 9.9 11.3 10.5 11.2
8.7 9.3 8.2 8.3 9.0 9.4 9.2 12.2 8.5 9.9
12.7 13.2 11.8 11.9 12.2 11.2 13.7 11.8 11.5 11.7
;
ods graphics on;
proc glm data=wloss;
class diet;
model WeightLoss = diet;
lsmeans diet / pdiff=all adjust=tukey LINES; /* get Lines Plot */
run;
ods graphics off;
lsmeans diet / pdiff=all adjust=tukey LINES; /* get table display */
run;
quit;
PROC GLM is an interactive procedure, which means that you can use one PROC/RUN block to set up the model and analyze the data, and additional RUN blocks for further analysis. So you can turm ODS graphics ON and create the lines plot, then turn it OFF and get the table that contains the letters:
data wloss;
do diet = 'A','B','C','D','E';
do i = 1 to 10; input WeightLoss @@; output; end;
end;
datalines;
12.4 10.7 11.9 11.0 12.4 12.3 13.0 12.5 11.2 13.1
9.1 11.5 11.3 9.7 13.2 10.7 10.6 11.3 11.1 11.7
8.5 11.6 10.2 10.9 9.0 9.6 9.9 11.3 10.5 11.2
8.7 9.3 8.2 8.3 9.0 9.4 9.2 12.2 8.5 9.9
12.7 13.2 11.8 11.9 12.2 11.2 13.7 11.8 11.5 11.7
;
ods graphics on;
proc glm data=wloss;
class diet;
model WeightLoss = diet;
lsmeans diet / pdiff=all adjust=tukey LINES; /* get Lines Plot */
run;
ods graphics off;
lsmeans diet / pdiff=all adjust=tukey LINES; /* get table display */
run;
quit;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: