BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
fja
Lapis Lazuli | Level 10 fja
Lapis Lazuli | Level 10

Dear Community!

I produce a few histograms using sgplot that result in a list (i.e. one column) of plots. Now I wonder if one could have that output to a two column list or - more generally speaking - to a nxm matrix like panel ...

Actually I expected this to  be a FAQ but i could not spot any entry in this forum dealing with it. Might be that I picked the wrong keywords ... or that I am barking up the wrong tree alltogether. 

Any hint is appreciated.

Cheers

Fja

/* just for illustrating what I am doing. hence, no data provided*/
proc sgplot data=have;
  by GroupCol;
  histogram xCol / FREQ=yCol;
run;

edit:

... I should have mentioned that SGPANEL does not seem to be an option, as the graphs are stuck together sharing axis lables ... I am actually aiming at keeping the plots separate and just changing the fashion/order in which  they are displayed.

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

> ... I should have mentioned that SGPANEL does not seem to be an option, as the graphs are stuck together sharing axis lables ... I am actually aiming at keeping the plots separate and just changing the fashion/order in which  they are displayed.

 

It sounds like you want to use the ODS LAYOUT GRIDDED to display two graphs on each rows:

ods layout gridded columns=2 advance=table;
   proc sgplot data=have;
      by GroupCol;
      histogram xCol;
  run;
ods layout end;

DIscussion and examples of the ODS GRIDDED LAYOUT statement at

Use ODS to arrange graphs in a panel

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

Example of histograms using PROC SGPANEL: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/grstatproc/n1nxbz16c4f9b4n1nnrd3aaor1lw.htm#n...

 

I realize you have presented to us fake code, but you should still make sure it at least makes sense. This line makes no sense:

 

 histogram xCol / FREQ=xCol;
--
Paige Miller
fja
Lapis Lazuli | Level 10 fja
Lapis Lazuli | Level 10

Correct. 🙂🙂 ... but "fake" code is a bit harsh, is it not? 🙂

Rick_SAS
SAS Super FREQ

> ... I should have mentioned that SGPANEL does not seem to be an option, as the graphs are stuck together sharing axis lables ... I am actually aiming at keeping the plots separate and just changing the fashion/order in which  they are displayed.

 

It sounds like you want to use the ODS LAYOUT GRIDDED to display two graphs on each rows:

ods layout gridded columns=2 advance=table;
   proc sgplot data=have;
      by GroupCol;
      histogram xCol;
  run;
ods layout end;

DIscussion and examples of the ODS GRIDDED LAYOUT statement at

Use ODS to arrange graphs in a panel

fja
Lapis Lazuli | Level 10 fja
Lapis Lazuli | Level 10
ods layout gridded columns=2 advance=table;
ods layout end;

Hi Rick!

This did it. Thank you very much! The link to provided is great!

Cheers 

Folkert

SAS Innovate 2025: Call for Content

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 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 4 replies
  • 612 views
  • 4 likes
  • 3 in conversation