BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
catch18
Obsidian | Level 7

Hi,

 

I get just the graphs I need from proc glm.

However I was trying to create a grid/panel of 3 columns with four rows. My code for the first row of three is as below.

ods select none;

ods graphics on;

options papersize="ISO A4" orientation=landscape nodate nonumber;

ods pdf file="C:\Users\tertile_graph.pdf";

ods graphics / width=8.1cm height=6cm noborder;

ods layout gridded columns=3;

ods region;

proc GLM data=Want;

CLASS X_tert;

MODEL fr = X_tert/solution;

MEANS X_tert/Bon CLDIFF;

ods output Parameterestimates=Parms;

run;

ods region;

proc GLM data=Want;

CLASS Y_tert;

MODEL fr = Y_tert/solution;

MEANS Y_tert/Bon CLDIFF;

ods output Parameterestimates=Parms;

RUN;

ods region;

proc GLM data=Want;

CLASS Z_tert;

MODEL fr = Z_tert/solution;

MEANS Z_tert/Bon CLDIFF;

ods output Parameterestimates=Parms;

RUN;

ods layout end;

ods pdf close;

ods graphics off;

run;

 

I initially put ods select none before each of the 3 proc glm statement to suppress the excess data results and I wasn't getting any error statement but wasn't also getting my graphs.

 

So I changed to putting one ods select none statement as in the pasted code and the log states:

WARNING: Output 'out' 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.

 

Any help would be greatly appreciated. Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

ODS SELECT NONE suppresses all tables and all graphs. 

 

At this point, the state of your ODS destination is probably messed up. Exit out of SAS and restart. When you run my example (and nothing else), you should not get any errors or warnings. 

 

Again, I strongly encourage you to produce the 12 graphs that you want FIRST before you try to worry about arranging them in a grid.

 

After rereading your posts, I suspect you are trying to do something like the following:

 

ods noproctitle;
ods graphics on;
ods graphics / width=8.1cm height=6cm noborder;
ods layout gridded columns=3 advance=table;

ods output Parameterestimates(PERSIST)=Parms; 
/* select two graphs for display and save table to data set */
proc GLM data=Sashelp.Cars;
  CLASS Origin;
  MODEL MPG_City = Origin /solution;
  MEANS Origin/Bon CLDIFF;
  ods select GLM.ANOVA.MPG_City.BoxPlot;
quit;
proc GLM data=Sashelp.Cars;
  where Type in ("Sedan" "Truck" "Wagon");
  CLASS Type;
  MODEL MPG_City = Type /solution;
  MEANS Type/Bon CLDIFF;
  ods select GLM.ANOVA.MPG_City.BoxPlot;
quit;
proc GLM data=Sashelp.Cars;
  where Cylinders in (4 6 8);
  CLASS Cylinders;
  MODEL MPG_City = Cylinders /solution;
  MEANS Cylinders/Bon CLDIFF;
  ods select GLM.ANOVA.MPG_City.BoxPlot;
quit;

ods layout end;
ods select all;

View solution in original post

6 REPLIES 6
Rick_SAS
SAS Super FREQ

Change the RUN statements to QUIT statements. 

 

PROC GLM is an interactive procedure, so the ODS tables and graphs are not fully written until the procedure ends. The GLOBAL SAS statements such as ODS REGION  statements are being processed by the previous procedure instead of the subsequent procedure. For a full explanation, see 

"SAS tip: Put ODS statements inside procedures"

and the section "CounterPoint" section in the following article: 

"Point/Counterpoint: Where should you put ODS SELECT and ODS OUTPUT statements?"

 

catch18
Obsidian | Level 7

Thanks, Rick.

I've changed the run statements to quit and I don't get error messages, but SAS gives me a blank pdf document with no graphs?

 

Thanks.

Rick_SAS
SAS Super FREQ

Great. Now to your problem.  I suggest you don't worry about grids and destinations until you can successfully generate the output that you want.

 

What graphs (or tables) do you want to display? Your code currently uses ODS SELECT NONE, which will turn off both graphs and tables. You need to ODS SELECT the graphs or tables that you want. You can use ODS TRACE ON to find the names of the graphs that you want.

 

With the syntax you are using, I see two graphs that are produced. What output should go into the third column?

 

Here is an example to get you started:

/* what are the names of the tables and graphs? */
ods trace on;
ods select all;
proc GLM data=Sashelp.Cars;
CLASS Origin;
MODEL MPG_City = Origin /solution;
MEANS Origin/Bon CLDIFF;
quit;
ods trace off;

/* select two graphs for display and save table to data set */
proc GLM data=Sashelp.Cars;
CLASS Origin;
MODEL MPG_City = Origin /solution;
MEANS Origin/Bon CLDIFF;
ods select GLM.ANOVA.MPG_City.BoxPlot
           GLM.Means.Origin.MPG_City.BoxPlot;
ods output Parameterestimates=Parms; 
quit;
catch18
Obsidian | Level 7

I don't want to output any tables and I thought I read from SAS to use ods select none to suppress all tables, while using ods output to select only the data to be kept but I probably read wrong.

 

With your second code I get this error log:

NOTE: The data set WORK.PARMS has 4 observations and 7 variables.

WARNING: Output 'GLM.Means.Origin.MPG_City.BoxPlot' 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 'GLM.ANOVA.MPG_City.BoxPlot' 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.

 

Thanks.

Rick_SAS
SAS Super FREQ

ODS SELECT NONE suppresses all tables and all graphs. 

 

At this point, the state of your ODS destination is probably messed up. Exit out of SAS and restart. When you run my example (and nothing else), you should not get any errors or warnings. 

 

Again, I strongly encourage you to produce the 12 graphs that you want FIRST before you try to worry about arranging them in a grid.

 

After rereading your posts, I suspect you are trying to do something like the following:

 

ods noproctitle;
ods graphics on;
ods graphics / width=8.1cm height=6cm noborder;
ods layout gridded columns=3 advance=table;

ods output Parameterestimates(PERSIST)=Parms; 
/* select two graphs for display and save table to data set */
proc GLM data=Sashelp.Cars;
  CLASS Origin;
  MODEL MPG_City = Origin /solution;
  MEANS Origin/Bon CLDIFF;
  ods select GLM.ANOVA.MPG_City.BoxPlot;
quit;
proc GLM data=Sashelp.Cars;
  where Type in ("Sedan" "Truck" "Wagon");
  CLASS Type;
  MODEL MPG_City = Type /solution;
  MEANS Type/Bon CLDIFF;
  ods select GLM.ANOVA.MPG_City.BoxPlot;
quit;
proc GLM data=Sashelp.Cars;
  where Cylinders in (4 6 8);
  CLASS Cylinders;
  MODEL MPG_City = Cylinders /solution;
  MEANS Cylinders/Bon CLDIFF;
  ods select GLM.ANOVA.MPG_City.BoxPlot;
quit;

ods layout end;
ods select all;
catch18
Obsidian | Level 7

This is exactly what I wanted and it works perfectly after I rerun SAS!! Thank you so much

 

My aim though was to have one Y axis label for each set of three rows instead of the repetition for each graph and to have one set of three titles on top for all 12 graphs instead of repeating the recurring x-axis labels. Is this possible with graphs from proc glm? I was able to achieve this with proc sgplot but not so much with proc glm?

 

Many thanks

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 774 views
  • 0 likes
  • 2 in conversation