<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: PDF output with one bookmark in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PDF-output-with-one-bookmark/m-p/651669#M24139</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Well, I will give you the points, as this code did what was needed.&amp;nbsp; However the moment I add anything to it then it breaks.&amp;nbsp; For instance, try adding: ods escapechar="^"; before that, I then get no graph output.&amp;nbsp; Adding RTF ods around that, i.e. to get the same output to two ods leads to a warning, and empty pdf output.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will stick with the create an RTF file, then use Adobe to create PDFs from there, it seems to be the only method which reliably works.&amp;nbsp; I would suggest though that SAS add something like this in as often people want to generate a file with just the one bookmark form compilation into other documents, I mean its Adobe default behaviour so its very strange that it is not available from SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Fri, 29 May 2020 09:26:51 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2020-05-29T09:26:51Z</dc:date>
    <item>
      <title>PDF output with one bookmark</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PDF-output-with-one-bookmark/m-p/649859#M24105</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Ok, I have been banging my head against a wall for too long on what should be a very simple task.&amp;nbsp; What I want is an output file, of type PDF, with one bookmark - this being for page 1, not other bookmarks.&lt;/P&gt;
&lt;P&gt;I have tried half a dozen different methods and none of them seem to work.&lt;/P&gt;
&lt;P&gt;So if I try:&lt;/P&gt;
&lt;PRE&gt;ods proclabel="My bookmark";
title "A title";
footnote "A footnote";
ods pdf file="want.pdf";
ods pdf bookmarkgen;
proc sgplot data=sashelp.class;
  scatter x=age y=height;
run;
ods pdf nobookmarkgen;
proc sgplot data=sashelp.class;
  scatter x=age y=weight;
run;
ods pdf close;

&lt;/PRE&gt;
&lt;P&gt;This creates the PDF correctly, with titles/footnotes, with my bookmark, but also with the secondary bookmark "The sgplot procedure".&amp;nbsp; Attempting to description="" to the first proc sgplot removes that text, but still leaves a bookmark there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have also tried proc document.&amp;nbsp; However when I run graphs through that, they work fine for RTF destination, titles/footnotes, but in PDF titles/footnotes are not showing (i.e. have RTF and PDF open when replay is called).&amp;nbsp; I can move the graphs up to the top level, but I still also get bookmarks for each graph, but now no titles or footnotes.&lt;/P&gt;
&lt;PRE&gt;ods document name=tmp(write);
title "A title";
footnote "A footnote";
proc sgplot data=sashelp.class;
  x=age y=height;
run;
proc sgplot data=sashelp.class;
  x=age y=weight;
run;
ods document close;
ods rtf file="myfile.rtf";
ods pdf file="myfile.pdf";
proc document name=tmp;
  replay;
run; quit;
ods rtf close;
ods pdf close;
&lt;/PRE&gt;
&lt;P&gt;In the above, the RTF has titles, the PDF has no titles (bad).&amp;nbsp; The RTF has no bookmarks (good), the PDF has four bookmarks, two for each proc (bad).&lt;/P&gt;
&lt;P&gt;For the bookmarks I tried adding:&lt;/P&gt;
&lt;PRE&gt;proc document name=tmp;
  setlabel \SGPlot#2\SGPlot#1 '';
  move \SGPlot#2\SGPlot#1 to SGPlot#1;
  delete \SGPlot#2;
  replay;
run; quit;&lt;/PRE&gt;
&lt;P&gt;However I still get no titles in the PDF, and I have one bookark with two sub bookmarks then.&lt;/P&gt;
&lt;P&gt;(Do note, this is an example, there maybe several proc statements, from report and sgplot and GTL, I still only want one bookmark per output file).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why can this process not be simply, as I surely can't be the only person who wants one bookmark per output:&lt;/P&gt;
&lt;PRE&gt;ods pdf file="want.pdf" bookmark="my bookmark";
...
ods pdf close;&lt;/PRE&gt;
&lt;P&gt;Its really frustrating that this seeming simple task looks like it requires third party tools to make effective.&lt;/P&gt;</description>
      <pubDate>Fri, 22 May 2020 10:51:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PDF-output-with-one-bookmark/m-p/649859#M24105</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2020-05-22T10:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: PDF output with one bookmark</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PDF-output-with-one-bookmark/m-p/651433#M24136</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can get exactly the result you are looking for using the ODS DOCUMENT destination and PROC DOCUMENT to replay your graphs to the ODS PDF destination.&lt;/P&gt;
&lt;P&gt;That approach allows you to get a finer control over several things, such as the PDF bookmarks.&lt;/P&gt;
&lt;P&gt;I changed your code a little bit to first generate the graphs into the ODS DOCUMENT:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ODS html close;
ODS pdf close;

ods document name=graphdocument(write); 
title "A title";
footnote "A footnote";

proc sgplot data=sashelp.class ;
  scatter x=age y=height ;
run;

title "A title - chart 2";
footnote "A footnote - chart 2";
ods proclabel="";
proc sgplot data=sashelp.class ;
  scatter x=age y=weight;
run;
ods document close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and next replay it :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods pdf file = "want.pdf" ;
proc document;
 doc name=graphdocument ;
  copy \SGPlot#1\SGPlot#1 to \temp;
  setlabel \temp "This is graph 1";
  replay \temp;

  copy \SGPlot#2\SGPlot#1 to \temp;
  setlabel \temp "This is graph 2";
  replay \temp;

 quit;
 ODS PDF close;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is what the result looks like:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2020-05-28_174508.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/40103i7C41D419A7E48D1D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2020-05-28_174508.png" alt="2020-05-28_174508.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Should you want to learn more about how to find the names of the graphs, you can use this piece of code to get the contents of the document:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods output properties=myds;
ods html;
 proc document name=graphdocument;
 list / levels=all;
 run;
 quit;
ods html close;
ods output close; 
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can use that dataset (type ne "Dir") to iterate through all the contents and replay it as you like to completely automate this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this is what you were looking for!&lt;/P&gt;
&lt;P&gt;Greetings,&lt;/P&gt;
&lt;P&gt;Mathias.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2020 15:48:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PDF-output-with-one-bookmark/m-p/651433#M24136</guid>
      <dc:creator>MCoopmans</dc:creator>
      <dc:date>2020-05-28T15:48:48Z</dc:date>
    </item>
    <item>
      <title>Re: PDF output with one bookmark</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PDF-output-with-one-bookmark/m-p/651535#M24137</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your reponse, however you have misunderstood the question.&amp;nbsp; The point is that I would like to have one bookmark per file, regardless of what procs are output to it.&amp;nbsp; You have shown this in the screenshot you post, there is one file called want.pdf, but it has two bookmarks.&amp;nbsp; I want want.pdf with one bookmark at page 1 only.&amp;nbsp; There isn't a way in ods document to remove the second bookmark (not the second level bookmark, that is possible).&amp;nbsp; So another way of explaining, from your pdf output, I only want to see "This is graph 1", even though both graphs output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To put it another way, if you create an rtf file with lots of different proc outputs, report, graphs etc.&amp;nbsp; Then Create a PDF in Adobe from that file with not further options, you get a file with the same name, but pdf extension, and 1 bookmark as the filename.&amp;nbsp; It does not matter what the contents of the rtf are, 1 bookmark per 1 file.&amp;nbsp; Hence why, I would set it up so its on the ods line as int:&lt;/P&gt;
&lt;PRE&gt;ods rtf "somefile.rtf" bookmark="This is the only bookmark I want in the file";
...
ods rtf close;&lt;/PRE&gt;
&lt;P&gt;I don't believe this is a new question, I am sure when I was using 8.2 back in the day, this is why we did not use ods pdf, but it still hasn't changed.&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2020 19:53:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PDF-output-with-one-bookmark/m-p/651535#M24137</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2020-05-28T19:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: PDF output with one bookmark</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PDF-output-with-one-bookmark/m-p/651631#M24138</link>
      <description>&lt;P&gt;Give the code below a go. We do need to create some output to get the first bookmark&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods pdf file="c:\temp\want.pdf" startpage=no;
ODS PROCLABEL 'ods proc label';

data _null_;
  declare odsout ODS();
  ODS.note(data: " ",  style_attr: 'font_size=1pt');
run;

ods pdf nobookmarkgen;

proc sgplot data=sashelp.class;
  scatter x=age y=height;
run;

ods pdf startpage=yes;

proc sgplot data=sashelp.class;
  scatter x=age y=weight;
run;

ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 May 2020 06:24:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PDF-output-with-one-bookmark/m-p/651631#M24138</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2020-05-29T06:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: PDF output with one bookmark</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PDF-output-with-one-bookmark/m-p/651669#M24139</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Well, I will give you the points, as this code did what was needed.&amp;nbsp; However the moment I add anything to it then it breaks.&amp;nbsp; For instance, try adding: ods escapechar="^"; before that, I then get no graph output.&amp;nbsp; Adding RTF ods around that, i.e. to get the same output to two ods leads to a warning, and empty pdf output.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will stick with the create an RTF file, then use Adobe to create PDFs from there, it seems to be the only method which reliably works.&amp;nbsp; I would suggest though that SAS add something like this in as often people want to generate a file with just the one bookmark form compilation into other documents, I mean its Adobe default behaviour so its very strange that it is not available from SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 09:26:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PDF-output-with-one-bookmark/m-p/651669#M24139</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2020-05-29T09:26:51Z</dc:date>
    </item>
  </channel>
</rss>

