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-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 lock in 2025 pricing—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
  • 1248 views
  • 0 likes
  • 2 in conversation