BookmarkSubscribeRSS Feed
FROA
Calcite | Level 5

How can I combine the prediction plot of the three below models into one plot? If you can give me a sample code, I would really appreciate it. Thanks!

proc glm data = Test_data outstat = p_value plots=diagnostics;
model weight = bmi / CLPARM solution;
run;
proc glm data = plasma outstat = p_value plots=diagnostics;
model height = weight / CLPARM solution;
run;
proc glm data = plasma outstat = p_value plots=diagnostics;
model bmi = weight / CLPARM solution;
run;

4 REPLIES 4
PaigeMiller
Diamond | Level 26

Do you mean 3 plots side-by-side fitting on one page? Or 3 plots one above the other fitting on one page? Or some other arrangement fitting on one page? 

 

Please explain.

 

Also, what is the purpose of modeling WEIGHT=BMI and then later BMI=WEIGHT?

--
Paige Miller
FROA
Calcite | Level 5

Hi Paige,

 

Thank you for replying!
The order does not matter, and these are only template models, not the actual models. BMI and Weight could be replaced by any other variable. I just am looking for a sample code to combine different "glm" models' plots into one table/page of plots.

PaigeMiller
Diamond | Level 26

ODS EXCEL can put many plots onto a single tab, so you can just scroll down in Excel to see them all. Is that what you want?

 

ods excel file='myfile.xlsx' options(sheet_interval='NONE');
ods excel select diagnosticspanel(persist);
proc glm data = Test_data outstat = p_value plots=diagnostics;
model weight = bmi / CLPARM solution;
run; quit;
proc glm data = plasma outstat = p_value plots=diagnostics;
model height = weight / CLPARM solution;
run; quit;
proc glm data = plasma outstat = p_value plots=diagnostics;
model bmi = weight / CLPARM solution;
run; quit;
ods excel close;
--
Paige Miller
Rick_SAS
SAS Super FREQ

It sounds like you want to use the ODS LAYOUT GRIDDED statement. See 

https://blogs.sas.com/content/sasdummy/2015/11/23/ods-statement-options-to-change/
AND
https://blogs.sas.com/content/graphicallyspeaking/2017/08/14/advanced-ods-controlling-precisely-outp...

 

Here's how it would look for some sample data:

ods layout gridded columns=2 advance=table;
ods noproctitle;
ods graphics / width=400px height=300px;
ods select FitPlot(persist);

proc glm data = sashelp.heart outstat = p_value plots(MAXPOINTS=NONE)=diagnostics;
model weight = MRW / CLPARM solution;
run;
proc glm data = sashelp.heart outstat = p_value plots(MAXPOINTS=NONE)=diagnostics;
model height = weight / CLPARM solution;
run;
proc glm data = sashelp.heart outstat = p_value plots(MAXPOINTS=NONE)=diagnostics;
model MRW = weight / CLPARM solution;
run;
quit;

ods layout end;

Alternatively, you can write the data to a SAS data set and use PROC SGPANEL to create the graphs yourself.

sas-innovate-wordmark-2025-midnight.png

Register Today!

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.


Register now!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 4 replies
  • 847 views
  • 0 likes
  • 3 in conversation