I keep am able to run the exact same program in Base SAS and Enterprise Guide to produce a PDF document with a table of contents. However, in Base SAS I get a printable table of contents, but in Enterprise Guide the final PDF does not contain a printable table of contents. Everything else about the files looks the exact same, except the printable table of contents is in the PDF file generated from Base SAS and not in the PDF generated from Enterprise Guide.
I have been researching this for a couple days and tried several different options and I haven't been able to find a solution. Appreciate any help!
options nodate;
run;
ods pdf file="filepath.pdf" startpage=no contents=yes uniform;
%macro cat (pred,i,tlb,);
ods proclabel="&tlb";
ods trace on;
proc tabulate data=new2 f=10.2 S=[foreground=black background=white just=c font_size=3.75] ;
class &pred/preloadfmt order=data;
classlev &pred/s=[foreground=black background=bwh font_size = 3.75];
table &pred=' ' all={label="All" s=[just=L foreground=black background=bwh font_size=3.75]},(n*f=8. colpctn*f=mypct.)/box=[label="&tlb"
style=[background=beige
foreground=black font_size = 3.75 width=60%]] row=float printmiss contents="&tlb";
keyword n colpctn/style=[background=beige foreground=black font_size=3.75] ;
keylabel n="Freq" colpctn="%";
run;
%mend cat;
%cat (dem1,1,var1);
%cat (dem2,2,var2);
%cat (dem3,3,var3);
%cat (dem4,4,var4);
%cat (dem5,5,var5);
ods pdf close;
Hi:
It's not the style. It is something related to this Tech Support note: http://support.sas.com/kb/56/041.html -- where the PRINTERPATH needs to be set to PDF BEFORE the code that generates the ODS PDF file.
I was able to replicate the issue in EG with simpler code and once I added
options printerpath=pdf;
The Table of Contents page was generated for PDF.
Cynthia
Can you show the entire base program that worked from the ODS PDF statement to the ODS PDF Close?
And by any chance is your Enterprise Guide running on a server? The ODS Style might vary from your Base SAS causing an issue.
Hi ballardw,
Is this what you were needing?
ods pdf file="filepath.pdf" startpage=no contents=yes uniform;
%macro cat (pred,i,tlb,);
ods proclabel="&tlb";
ods trace on;
proc tabulate data=new2 f=10.2 S=[foreground=black background=white just=c font_size=3.75] ;
class &pred/preloadfmt order=data;
classlev &pred/s=[foreground=black background=bwh font_size = 3.75];
table &pred=' ' all={label="All" s=[just=L foreground=black background=bwh font_size=3.75]},(n*f=8. colpctn*f=mypct.)/box=[label="&tlb"
style=[background=beige
foreground=black font_size = 3.75 width=60%]] row=float printmiss contents="&tlb";
keyword n colpctn/style=[background=beige foreground=black font_size=3.75] ;
keylabel n="Freq" colpctn="%";
run;
%mend cat;
%cat (dem1,1,var1);
%cat (dem2,2,var2);
%cat (dem3,3,var3);
%cat (dem4,4,var4);
%cat (dem5,5,var5);
ods pdf close;
This might be an issue with some difference in the way EG uses the default PDF style. Try adding a specific style to the ODS PDF statement such as: Style=Styles.HtmlBlue
This will likely change a number of appearance options but if the TOC prints then we know its a style issue.
But again. is your EG running on a server or local?
Hi:
It's not the style. It is something related to this Tech Support note: http://support.sas.com/kb/56/041.html -- where the PRINTERPATH needs to be set to PDF BEFORE the code that generates the ODS PDF file.
I was able to replicate the issue in EG with simpler code and once I added
options printerpath=pdf;
The Table of Contents page was generated for PDF.
Cynthia
I believe it is local.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.