I am creating a multi-page pdf report containing a cover page and a table of contents.
Page 1 (cover page) is fine. On page 2, how do I move the Table of Contents so that is starts closer to the top of the page instead of starting at the middle of the page?
Here's my code:
options nodate /*nonumber*/ ORIENTATION=portrait
topmargin = .01in bottommargin = .01in leftmargin = .01in rightmargin = .01in;
ods escapechar = "^";
ODS pdf file='C:\user\BP23\Express_v6\FY23_Plan_Visualizations.pdf' startpage=no notoc;
ods noproctitle;
data test;
text="^nFY23 Express Business Plan:^nData Tables & Visualizations";
run;
* Insert a logo and blank lines (used to move the title text to the center of page);
ods pdf text='^S={preimage="C:\user\BP23\Express_v6\fedex_big_logo.png"}';
ods pdf text="^20n";
* Output the title text;
proc report data=test noheader center
style(report)={rules=none frame=void}
style(column)={font_weight=bold font_size=20pt just=c};
run;
ods pdf startpage=now;
*****start of table of contents;
data test;
text="^nTable of Contents^n
^nSmall Package:
^nPO............................3
^**bleep**............................4
^nIE............................5
^nTD............................6
^nE2............................7
^nSO............................8^n
^nFreight:
^nIPFS.........................9
^nIEF.........................10
^nF1............................11
^nIXF...........................12
^nSpecial Aggregates:
^nTotal Express................13
^nE-Commerce...................14
^nBusiness-to-Business (B2B)...15
";
run;
* Insert a logo and blank lines (used to move the title text to the center of page);
ods pdf text='^S={preimage="C:\user\BP23\Express_v6\fedex_big_logo.png"}';
ods pdf text="^20n";
* Output the title text;
proc report data=test noheader
style(report)={rules=none frame=void}
style(column)={font_weight=bold font_size=20pt just=c};
run;
ods pdf startpage=now;
Remove this line?
ods pdf text="^20n";
That's it! After removing the line
ods pdf text="^20n";
in the table of contents page section, the positioning is perfect:
A minor style suggestion: Move creation of all data sets out of your ODS destination/ ods destination close "sandwich". It will make the output creation more obvious and shorten that code. If you recreate the same data set many times, such as would happen with a test of different report or graph options, you may add significant time to your program run time and test cycles.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
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.
Ready to level-up your skills? Choose your own adventure.