- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
i'd like to place output from 2 or more sgscatter plots on the same row. so, imagine that i have two sgscatter statements. i'd like them to both show up on the same row (rather than sequentially). see below for an example. thanks for suggestions
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
As Reeza says, the ODS LAYOUT GRIDDED statement is a great choice for destinations that support it. For details and examples, see
"Using the ODS statement to add layers in your ODS sandwich"
and
"Arrange matrices and graphs in a gridded layout"
Your code might look like this:
ods graphics / width=500px height=500px;
ods layout gridded columns=2 advance=table;
proc sgscatter data=FIRST;
...
run;
proc sgscatter data=SECOND;
...
run;
ods layout end;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What's your destination?
ODS HTML, PDF, RTF?
If PDF it supports a COLUMN statement so if you specify two columns they'll come side by side.
You can also look at ODS LAYOUT and/or SGPANEL as alternate options but they're more complex.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
thanks. html but i could make it pdf. i may not have been sufficiently clear about my objective. sgpanel doesn't support what i'm looking to do--altho it would come close to doing so if i could place multiple sgpanel outputs side by side. from your ods layout suggestion, i see where i might be able to generate side-by-side matrix plots using ods document (altho i'm hoping for a simpler solution).
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
options orientation=landscape;
ods pdf file='C:\_localdata\temp\demo.pdf' columns=2 style=seaside;
ods graphics / width= 4in height=5in;
proc sgscatter data=sashelp.class;
matrix age weight height / group=sex;
run;
proc sgscatter data=sashelp.cars;
matrix mpg_city mpg_highway msrp invoice;
run;
ods pdf close;
COLUMNS is the easiest option - make sure you set the graphs to a size that will fit on the page. Fully worked example above.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi Reeza, many thanks for your and Rick's solutions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
As Reeza says, the ODS LAYOUT GRIDDED statement is a great choice for destinations that support it. For details and examples, see
"Using the ODS statement to add layers in your ODS sandwich"
and
"Arrange matrices and graphs in a gridded layout"
Your code might look like this:
ods graphics / width=500px height=500px;
ods layout gridded columns=2 advance=table;
proc sgscatter data=FIRST;
...
run;
proc sgscatter data=SECOND;
...
run;
ods layout end;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
hi. this works great (even with a BY statement)--with one hitch. the hitch is that repeat uses of the code lead to pages that are centered on the right margin of my screen (ie much of the plot is off screen). a not-so-great fix is to close the html output; perhaps someone can provide a less drastic fix? many thanks.
my current code is as follows:
title1 "Matrix plots";
ods graphics / width=400px height=400px;
ods layout gridded columns=3 advance=table;
proc sgscatter data=zibout32(where=(sim le 3));
matrix b00psi_ g00p_ taupsi_ b0psi_1 b0psi_10;
by b0 b1 b1SD b2 g0 g1 g1SD g2 taupsi rho taup taupsite seasons sites n_ sim;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You need to end the layout;
ODS LAYOUT END;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
ignore my comment re centering; this problem appears to have been caused by my failure to add ods layout end;