Hello,
I have created several tables using RWI in my PDF files. Now I want to create a summary page at the last page and generate the link to the tables in previous pages. How could I do that? Thanks in advance.
Here is sample of my program:
ods pdf file="myfile.pdf";
data _null_;
set myset end=eof;
if _N_ = 1 then do;
dcl odsout o();
end;
/* table 1 */
o.table_start();
<...table 1 codes here ...>
o.table_end();
/* page break */
o.page();
/* table 2 */
o.table_start();
<...table 2 codes here ...>
o.table_end();
/* page break */
o.page();
/* table 3 */
o.table_start();
<...table 3 codes here ...>
o.table_end();
/* may I have new page contains the link to table 1 2 3? */
o.page();
o.table_start();
o.row_start();
o.format_cell(data: "Table 1", ??? how to link to Table 1?
o.format_cell(data: "Table 2", ??? how to link to Table 2?
o.format_cell(data: "Table 3", ??? how to link to Table 3?
o.row_end();
o.table_end();
if EOF then do;
o.delete();
end;
run;
ods pdf close;
You can make use of the
ods pdf anchor="...";
to specify how bookmarks for table should start with.
You can then use the URL inline attribute to create a link to a corresponding "bookmark". See code sample below.
options nocenter;
ods pdf file="c:\temp\anchor_test2.pdf" anchor="table1";
title;
footnote;
data _null_;
dcl odsout o();
nTables = 3;
do table = 1 to nTables;
o.table_start();
do i = 1 to 10;
n = i * ((10 ** table) / 10);
o.row_start();
o.format_cell(data: catx(" ", "Table", table) );
o.format_cell(data: n);
o.format_cell(data: put(n, words32.) );
o.format_cell(data: put(n, roman.) );
o.row_end();
end;
o.table_end();
o.page();
end;
/* may I have new page contains the link to table 1 2 3? */
o.table_start();
do i = 1 to nTables;
o.row_start();
cellText = catx(" ", "Table", i);
urlLink = cats("URL='#table", i, "'");
o.format_cell(data: cellText, inline_attr: urlLink);
o.row_end();
end;
o.table_end();
run;
ods pdf close;
See also this SAS Note with some more examples http://support.sas.com/kb/24/174.html
You can make use of the
ods pdf anchor="...";
to specify how bookmarks for table should start with.
You can then use the URL inline attribute to create a link to a corresponding "bookmark". See code sample below.
options nocenter;
ods pdf file="c:\temp\anchor_test2.pdf" anchor="table1";
title;
footnote;
data _null_;
dcl odsout o();
nTables = 3;
do table = 1 to nTables;
o.table_start();
do i = 1 to 10;
n = i * ((10 ** table) / 10);
o.row_start();
o.format_cell(data: catx(" ", "Table", table) );
o.format_cell(data: n);
o.format_cell(data: put(n, words32.) );
o.format_cell(data: put(n, roman.) );
o.row_end();
end;
o.table_end();
o.page();
end;
/* may I have new page contains the link to table 1 2 3? */
o.table_start();
do i = 1 to nTables;
o.row_start();
cellText = catx(" ", "Table", i);
urlLink = cats("URL='#table", i, "'");
o.format_cell(data: cellText, inline_attr: urlLink);
o.row_end();
end;
o.table_end();
run;
ods pdf close;
See also this SAS Note with some more examples http://support.sas.com/kb/24/174.html
Works perfect!
Thank you!
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.