SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
JeffMeyers
Barite | Level 11

Hello, I'm trying to make a report in ODS PDF with a lot of images where I want to set the PAPERSIZE to best fit the image.  I've done this before in ODS EXCEL, but can't seem to make it work in ODS PDF.  I get stuck when trying to do an ODS LAYOUT in the new PAPERSIZE and it won't work because the height is taller than the first page's PAGESIZE.  Here's what I'm trying:

 

title;
option papersize = (14in 13in) orientation=landscape leftmargin=0.1in rightmargin=0.1in;
ods pdf file='early_onset_figures.pdf' notoc bookmarkgen=no;
**First graph code here;

option papersize = (9in 14in);
ods pdf;
title 'Figure 3';
ods layout start  rows=2 width=7in height=13in;
ods region;
**plot stuff here;
ods region;
**more plot stuff here;
ods layout close;
ods pdf close;

I tried changing the PAPERSIZE option prior to doing another ODS PDF statement and again without the ODS PDF statement with the same results.  I get a warning when I try to do the ODS LAYOUT statement that "WARNING: HEIGHT exceeds available space for PDF destination. This option will be ignored."  If I have the second PAPERSIZE option and I try changing the height to be anything and still get this warning for some reason.  If I set my PAPERSIZE to the second figure and don't try to change it I don't get this warning. Is this possible to change or does the PAPERSIZE when ODS PDF starts set for the rest of the document?

1 REPLY 1
Norman21
Lapis Lazuli | Level 10

I think the option statement can only be used while ods pdf is closed.

 

Using the following code on SAS EG produces two PDF documents which can then be combined:

title;
option papersize = (14in 13in) orientation=landscape leftmargin=0.1in rightmargin=0.1in;
ods pdf file="C:\My SAS\_examples_/early_onset_figures.pdf" notoc bookmarkgen=no;
**First graph code here;
title 'Figure 1';
ods layout start  rows=2 width=7in height=12in;
ods region;
**plot stuff here;
ods region;
**more plot stuff here;
ods layout end ;
ods pdf close;

option papersize = (9in 14in);
ods pdf file="C:\My SAS\_examples_/early_onset_fig2.pdf";
title 'Figure 2';
ods layout start  rows=2 width=7in height=13in;
ods region;
**plot stuff here;
ods region;
**more plot stuff here;
ods layout end ;
ods pdf close;

By the way, the layout wrapper is "start" and "end" (not "close").

Norman.
SAS 9.4 (TS1M6) X64_10PRO WIN 10.0.17763 Workstation

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 1 reply
  • 1009 views
  • 0 likes
  • 2 in conversation