BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.

I'm using SGPANEL with ODS PDF with orientation=landscape and trying to make a plot that is 10 inches wide.

 

When I try below code, SGPANEL leaves a lot of space on the right, almost as if it's leaving room for an extra column.  How can I make the SGPANEL plot fill the page?

 

options orientation=landscape nocenter;
ods graphics/reset=all border=off width=10in;

ods listing close;
ods pdf file="%sysfunc(pathname(work))\Foo.pdf" style=pearl notoc ;    

title1 "Width of sgplot plot is good" ;
proc sgplot data=sashelp.class ;
  scatter x=height y=weight ;
run ;
title1 ;

title1 "Width of sgpanel plot is too narrow" ;
proc sgpanel data=sashelp.class ;
  panelby sex/ layout=rowlattice onepanel ;
  scatter x=height y=weight ;
run ;
title1 ;

ods _all_ close ;
ods listing ;

My pdf looks like:

Quentin_0-1768339058565.png

I tried making the graph narrower (8in or 9in) in case I was hitting the margins, but no luck.

 

SGPLOT works fine.

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

Try specifying both the width and the height on the ODS GRAPHICS statement. By default, the aspect of the graph is maintained when you specify only width or height. Hope this helps!

View solution in original post

7 REPLIES 7
DanH_sas
SAS Super FREQ

Try specifying both the width and the height on the ODS GRAPHICS statement. By default, the aspect of the graph is maintained when you specify only width or height. Hope this helps!

Quentin
Super User

Thanks for the thought Dan.  

 

When I try e.g. width=10in height=7in  the plot is empty and the log tells me:

Cell height -34 is smaller than the minimum cell height 1. All contents are removed from the layout.
Cell height -34 is smaller than the minimum cell height 1. All contents are removed from the layout.
sbxkoenk
SAS Super FREQ

Try using these options on the panelby statement (behind the forward slash):

LAYOUT=panel columns=4 novarname

Koen

Quentin
Super User

@sbxkoenk wrote:

Try using these options on the panelby statement (behind the forward slash):

LAYOUT=panel columns=4 novarname

Koen


That gives a single row with 4 columns, and uses the whole page correctly:

 

Quentin_2-1768398029139.png

 

But I want a single column, with two rows. If I use Layout=panel columns=1, I'm back to having an image half the width of the page:

Quentin_3-1768398051061.png

 

DanH_sas
SAS Super FREQ

I tried your test program using 10in by 7in and it worked as expected for me. Are there any other options active in your session?

DanH_sas
SAS Super FREQ

This is what I get with your test program at 10in by 7in:

DanH_sas_0-1768404831196.png

 

Quentin
Super User

Thanks @DanH_sas .  I tried again with width=10in height=7in today and it worked.  I'm pretty sure I was testing in a fresh session yesterday, so not sure how I managed to muck it up.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 199 views
  • 3 likes
  • 3 in conversation