BookmarkSubscribeRSS Feed
Karlb
Calcite | Level 5

We have the need to produce a large pdf-report (Proc report) with variable left-border-margins prepared for physical book-printing. All odd pages should be produced with left border-margin 3cm, all even pages with margin 4cm.

Is this somehow possible? Any ideas, suggestions?

 

Thanks,

Karl

1 REPLY 1
pink_poodle
Barite | Level 11

Here is a similar post: Changing margins in PDF output

 

Its code can be modified for your purpose by replacing the values of PAGENO= and LEFTMARGIN= with macro variables and adding little macro "driver" programs that would instruct different treatment for odd and even pages [1].

 

%macro leftmargin(&PAGENO, &LMAR);
options orientation=landscape nodate pageno=&PAGENO leftmargin=&LMAR rightmargin=.25in; ods pdf file='c:\temp\carss.pdf'; proc report data=sashelp.cars(obs=30) nowd; title '1) take all defaults'; run;

%mend;

 

 /*
Following are the driver macros for odd
and even pages, respectively
*/

 

%macro lmar_odds; 
%DO i = 1 %TO lastpage %BY 2; %leftmargin( &i, 3cm ) %END;
%mend; %macro lmar_evens;
%DO i = 2 %TO lastpage %BY 2; %leftmargin( &i, 4cm ) %END;
%mend;

 

/* Calling the macros */

 

%lmar_odds
%lmar_evens

 

Reference

 

[1]   %DO, Iterative Statement

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 957 views
  • 0 likes
  • 2 in conversation