BookmarkSubscribeRSS Feed
BTAinRVA
Quartz | Level 8


I'm using ODS Layout and SGPanel and want the chart to fill the page. Is there a way to do this?

Thanks,

Brian Adams

14 REPLIES 14
BTAinRVA
Quartz | Level 8

I am using the ODS Layou code below but the panel chart doesn't fill the page. I would like the chart to be larger. Is there a way to do this?

sascode.png

AncaTilea
Pyrite | Level 9

Hi.

If you add

ODS PDF "\\your_path\plot_full_page.pdf";

...

your proc sgpnale code

...

ODS PDF CLOSE;

It fills the page.

Maybe I don't fully understand what would you like to accomplish at the end?:smileyconfused:

BTAinRVA
Quartz | Level 8

Anca,

Thanks for the reply. Yes I do have that ODS PDF code sandwiched around my code. But the panel chart only fills about 70% of the available page area. I would like the chart to fill the entire page.

Thanks again,

Brian

AncaTilea
Pyrite | Level 9

Could you, please, try to change your width and height statement to:

width = 100pct height = 100pct;

Thanks!

Let me know if it works.

This is what I get -- see attached, using this code:

ods layout start width = 100pct height = 100pct;

ods escapechar = "^";

ods region width = 100pct height = 100pct ;*x = .1in y = .5in;

ods pdf file = "my_path....\plot.pdf";

proc sgpanel data = sashelp.class;

panelby sex/columns = 1 onepanel uniscale = all;

*format; *I don't have a format, but this shouldn't affect anything;

band x = height lower = 0 upper = 75/transparency= .5 legendlabel = "Height" fillattrs = (color = OLIVE);

series x = weight y = age/legendlabel = "Something" lineattrs = (color = MAROON thickness = 3);

run;

ods pdf close;

BTAinRVA
Quartz | Level 8

Anca,

Thanks again for the reply. When I run your code I again get a panel chart that only fills about 70% of the page. The output you posted looks like it used Proc SGPlot. When I run the code below I get a plot that only fills about half the page. (P.S. is there any way to copy/paste my code into these posts?)

sgplot.jpg

Jay54
Meteorite | Level 14

Try this.. This seems to works for me.

ods pdf file='c:\Plot.pdf';

ods graphics / reset width=100pct height=100pct;

proc sgplot data=sashelp.cars;

  histogram mpg_city;

  run;

ods pdf close;

ods pdf file='c:\Panel.pdf';

ods graphics / reset width=100pct height=100pct;

proc sgpanel data=sashelp.cars;

  panelby origin / layout=rowlattice onepanel;

  histogram mpg_city;

  run;

ods pdf close;

BTAinRVA
Quartz | Level 8

Sanjay,

Thanks for the reply!

Unfortunately it is not doing for me what it is doing for you. I think there must be some system settings that need to be changed on my end. I'm still getting a chart that only fills about 70% of the page (see attached file).

AncaTilea
Pyrite | Level 9

Very interesting.

Did you try 1. GOPTIONS reset = all;

          2. Close SAS and open it again.

Smiley Happy

BTAinRVA
Quartz | Level 8

Anca,

Thanks for the reply! I had great hopes that that would be the answer. But I did exactly what you suggested and I still get a chart that fills only about 70% of the page.

Jay54
Meteorite | Level 14

I am checking with others here who know more about ODS Layout.  However, do you need the ODS LAYOUT and the ODS REGION statements?  These are pre-production, and may not be doing what you want.  The example I sent you does not have those statements.  Yes, try this in a fresh session of SAS as suggested by Anca.

BTAinRVA
Quartz | Level 8

Sanjay,

Thanks for your help!

I copied the code you sent to a  new editor window and ran it without any of the ODS layout code and I still got the same results as before.

BTAinRVA
Quartz | Level 8

Anca & Sanjay,

I'm going to try running Sanjay's code on another pc to see if it's just something related to my installation. I'll let you know how it goes.

Thanks again!

Jay54
Meteorite | Level 14

You may need to define rows and columns when using ODS LAYOUT in PDF.

Can you attach your full code?

ods _all_ close;

ods pdf file='c:\Panel.pdf';

ods layout start rows=1 columns=1;

ods region;

ods graphics / reset width=100pct height=100pct;

proc sgpanel data=sashelp.cars;

  panelby origin / layout=rowlattice onepanel;

  histogram mpg_city;

  run;

ods pdf close;

Jay54
Meteorite | Level 14

You may be using some release of SAS 9.2.  In that case, the width=100% will not work on the ODS GRAPHICS statement will not work as it was not yet implemented for SAS 9.2.  Note ODS LAYOUT is pre-production and  it is implemented with SAS 9.3.

So, you will have to provide a specific size for the graph.  If this is a 8.5" x 11" page, I suggest using:

ods graphics / reset width=7.5in height=10in;

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
  • 14 replies
  • 4651 views
  • 6 likes
  • 3 in conversation