Hi,
I am trying to make a report in SAS. In the report I am making graphs using Proc gplot then exporting them to a pdf using ods pdf.
I also want Table of Contents in the front of the page with title & page number of the graphs.
When I use proclabel I get the bookmarks but not a proper Table of Contents like we get from word or any such software.
Does anyone know how can I get a proper TOC in the beginning of my report before the graphs are plotted?
Thanks
monika
Might want to clarify what is meant by "proper TOC" from Word as I have had this a lot over the years, things like page numbering, links to pages and such like is just very difficult in SAS.
Well, Cynthia is the SAS ODS expert, so I will just talk from my experience. I would personally do it this way. Output all files to RTF - in my industry it is standard to provide individual files anyway. Once you have these files combine them in word and add the TOC there, its pretty straightforward and even manually doesn't take more than a few minutes. Thn that whole file can be printed to PDF.
Creating a PDF directly from SAS which has links, relevant page numbers and such like is a real pain. I have tried it several times with not great results. Below is an example of where I had got to on this, as you can see I get links and can change fonts and what not, but you will need to calculate page numbers and things before and add them in. Total faff, thats why I recommend going through Word so you can use ^{thispage} of ^{lastpage} and let Word do all that for you.
ods document name=work.full_print (write); ods noproctitle; data work.cars; set sashelp.cars; flag=1; run; data work.class; set sashelp.class; flag=1; run; data work.x; attrib tct format=$200. ; flag=1; tct="^S={just=left vjust=middle cellheight=20pt font_size=10pt cellwidth=15cm linkcolor=white url='#rep1'} My link to cars section ^{thispage}"; output; tct="^S={just=left vjust=middle cellheight=20pt font_size=10pt cellwidth=15cm linkcolor=white url='#rep2'} My link to class section ^{thispage}"; output; run; title; footnote; proc report data=work.x nowd contents="" split='~' ls=256 ps=207 list missing style(column) = {font_size=6pt background=white just=l borderrightcolor=white borderleftcolor=white bordertopcolor=white borderbottomcolor=white linkcolor=white} style(header) = {font_size=6pt background=white just=c borderrightcolor=white borderleftcolor=white bordertopcolor=white borderbottomcolor=white linkcolor=white}; column flag tct; define tct / "Table of Contents" style={font_size=10pt just=c background=white borderrightcolor=white borderleftcolor=white bordertopcolor=white borderbottomcolor=white linkcolor=white}; define flag / noprint order; break before flag / page contents=''; run; title j=c "Cars"; proc report data=work.cars nowd contents=""; define flag / noprint order; break before flag / page contents=''; run; title j=c "Class"; proc report data=work.class nowd contents=""; define flag / noprint order; break before flag / page contents=''; run; ods document close; ods pdf file="S:\Temp\Rob\Content.pdf"; proc document name=work.full_print; list/levels=all; run; quit; ods pdf close; ods pdf file="S:\Temp\Rob\Content2.pdf" /*contents=yes*/; proc document name=work.full_print (update); ods escapechar="^"; setlabel Report#1 "Table of Contents"; setlabel Report#2 "Cars"; run; setlabel Report#3 "Class"; run; ods pdf anchor="toc"; replay Report#1; run; ods pdf anchor="rep1"; replay Report#2; run; ods pdf anchor="rep2"; replay Report#3; run; quit; ods pdf close;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.