<?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: ods pdf link to page by page number in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ods-pdf-link-to-page-by-page-number/m-p/622299#M23752</link>
    <description>&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;I finally recreated all file with anchors. it is a little time than created a content page using third party software because we need the information on that page which saved in sas data file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Feb 2020 20:54:00 GMT</pubDate>
    <dc:creator>cxterm</dc:creator>
    <dc:date>2020-02-04T20:54:00Z</dc:date>
    <item>
      <title>ods pdf link to page by page number</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ods-pdf-link-to-page-by-page-number/m-p/622041#M23748</link>
      <description>&lt;P&gt;Does SAS ods pdf can generate link to a page by the page number?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have about 1000 pdf files generated by SAS before and now combined into one pdf files name "all_test.pdf". I want to create an contents and link to the specific page. I wrote a code as follows:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods pdf file="contents.pdf";
data _null_;	
	length urlLink $48;	
	set ALL_TEST end=EOF;
	if _N_ = 1 then do;
		dcl odsout obj();
		obj.format_text(data: "Special Test Case", just: "C", style_attr: "fontsize=12pt fontweight=bold height=24pt");
		obj.table_start();				
	end;
	PAGE_NUM = 2 + (_N_ - 1)*15;
	urlLink = cats("URL='all_test.pdf#PAGE=",PAGE_NUM,"'");		
	obj.row_start();
	obj.format_cell(data: TEST_NUM, style_attr: "fontsize=10pt height=20pt "||urlLink);
	obj.row_end();
	if eof then do;
		obj.table_end();
		obj.delete();
	end;
run;
ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I insert this pdf to the first page of the all_test.pdf, all link works correct. However, if I rename the all_test.pdf to another name, for example, old_test.pdf, then the links were broken. I knew that because the link created in the table was tied with the name "all_test.pdf", but if I do not set the pdf name in the target, the link does not work anymore. And, I cannot find any SAS document about how to link to specific page by page number in the same pdf.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help? Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 20:49:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ods-pdf-link-to-page-by-page-number/m-p/622041#M23748</guid>
      <dc:creator>cxterm</dc:creator>
      <dc:date>2020-02-03T20:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: ods pdf link to page by page number</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ods-pdf-link-to-page-by-page-number/m-p/622071#M23749</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I know of 2 ways and this tech support note &lt;A href="http://support.sas.com/kb/24/174.html" target="_blank"&gt;http://support.sas.com/kb/24/174.html&lt;/A&gt; shows a 3rd way.&lt;/P&gt;
&lt;P&gt;My methods are:&lt;/P&gt;
&lt;P&gt;1) Use the default CONTENTS=YES so that the TOC on the first page takes you to the correct page&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods pdf file='c:\temp\default_links.pdf'
     contents=yes;

proc print data=sashelp.class;
  title 'Report SASHELP.CLASS';
run;
 
proc freq data=sashelp.class;
  title 'Frequency SASHELP.CLASS';
  tables age / nocum;
run;

ods pdf close;
title;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or 2) use ANCHOR= and LINK= (in a title) to control navigation.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods pdf file='c:\temp\test_links.pdf'
    anchor='REP' ;

proc print data=sashelp.class;
  title 'Report SASHELP.CLASS';
  title2 link='#FRQ' 'Go to Frequency for Age';
run;

ods pdf anchor='FRQ';
proc freq data=sashelp.class;
  title 'Frequency SASHELP.CLASS';
  title2 link='#REP' 'Go to Detail Report on Students';
  tables age / nocum;
run;
 
ods pdf close;
title;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Notice how the ANCHOR= provides the string to use for the report and then you use that string with a # as a URL to link to the first page. If either report was multi-page, then the link would take you to the first page of the report.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I guess there's a 4th way with ODS DOCUMENT and PROC DOCUMENT, but I'm not sure it gives you more control than these 3 methods -- well, maybe more control in rearranging the structure of the output objects.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; But with any of these methods, you have to put ALL the code that creates the separate reports in one ODS "sandwich" and even if you did use ODS DOCUMENT, then ALL the reports would need to be in an ODS DOCUMENT store.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 23:41:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ods-pdf-link-to-page-by-page-number/m-p/622071#M23749</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2020-02-03T23:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: ods pdf link to page by page number</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ods-pdf-link-to-page-by-page-number/m-p/622074#M23750</link>
      <description>&lt;P&gt;Thanks for the samples. I have noticed that in the link your provided. My problem is the other files were created already, I just want to generated a contents page only without recreated those files. Because there are no anchors were set when created those files, I can only refer to the page number. SAS looks only works with the hard coded PDF filename.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 00:17:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ods-pdf-link-to-page-by-page-number/m-p/622074#M23750</guid>
      <dc:creator>cxterm</dc:creator>
      <dc:date>2020-02-04T00:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: ods pdf link to page by page number</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ods-pdf-link-to-page-by-page-number/m-p/622087#M23751</link>
      <description>Hi:&lt;BR /&gt;  You may be better off using an Adobe tool or a 3rd party tool to combine PDFs and make your internal links then. To use a "named" link, you have to have the ANCHOR= turned on at creation time or you use the default anchors of #IDX,  #IDX1, #IDX2, etc.&lt;BR /&gt;&lt;BR /&gt;Cynthia</description>
      <pubDate>Tue, 04 Feb 2020 01:14:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ods-pdf-link-to-page-by-page-number/m-p/622087#M23751</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2020-02-04T01:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: ods pdf link to page by page number</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ods-pdf-link-to-page-by-page-number/m-p/622299#M23752</link>
      <description>&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;I finally recreated all file with anchors. it is a little time than created a content page using third party software because we need the information on that page which saved in sas data file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 20:54:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ods-pdf-link-to-page-by-page-number/m-p/622299#M23752</guid>
      <dc:creator>cxterm</dc:creator>
      <dc:date>2020-02-04T20:54:00Z</dc:date>
    </item>
  </channel>
</rss>

