Do anchor points work with proc document

Accepted Solution Solved
Reply
Super User
Super User
Posts: 7,430
Accepted Solution

Do anchor points work with proc document

Hi,

I was having a go at creating a TOC using proc ducment and got most of what I would like to work.  However when I have more than one anchor point, the link only seems to work for the first anchor, the second anchor appears to link, but with completely the wrong page.

The code:

ods document name=work.full_print (write);
ods proclabel="";
data work.cars; set sashelp.cars; flag=1;run;
data work.class; set sashelp.class; flag=1;run;
/* Create a dataset with the links to each report */

data work.x;
attrib tct format=$200.;
tct="^S={just=center vjust=middle cellheight=20pt font_size=10pt cellwidth=15cm linkcolor=black url='#rep1'} My link to cars section"; output;
tct="^S={just=center vjust=middle cellheight=20pt font_size=10pt cellwidth=15cm linkcolor=black url='#rep2'} My link to class section"; output;
run;
proc print data=work.x nobs;
run;
proc report data=work.cars nowd contents="" list;
define flag / noprint order;
break before flag / page contents='';
run;
proc report data=work.class nowd contents="" list;
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";
proc document name=work.full_print (update);
ods escapechar="^";
setlabel Report#1 "Cars"; run;
setlabel Report#2 "Class"; run;
ods pdf anchor="toc";
replay Print#1; run;

/* This anchor works correctly and goes to the right page when clicked on */
ods pdf anchor="rep1";
replay Report#1; run;

/* This anchor does not work correctly, when I click on it it jumps to page 6 rather than page 28 */
ods pdf anchor="rep2";
replay Report#2; run;
quit;
ods pdf close;


Accepted Solutions
Solution
‎04-16-2013 08:17 AM
Super User
Super User
Posts: 7,430

Re: Do anchor points work with proc document

Hi,

SAS Tech support got back to me on this issue.  It was to do with the use of a number in the anchor points.  If the above is changed from #rep1, #rep2, to #first_report and #second_report and changing the anchor points to match, the output is then correct.

If anyone has any good ideas on how to get the page numbers into the table of contents above that would be very helpfull.  So the output would look like the TOC from contents=yes in proc report (without dots preferably), but these would be linked directly to the first page of the relevant outputs:

i.e.

My link to cars  section                            2

My link to class section                            6

Thanks

Rob

View solution in original post


All Replies
Solution
‎04-16-2013 08:17 AM
Super User
Super User
Posts: 7,430

Re: Do anchor points work with proc document

Hi,

SAS Tech support got back to me on this issue.  It was to do with the use of a number in the anchor points.  If the above is changed from #rep1, #rep2, to #first_report and #second_report and changing the anchor points to match, the output is then correct.

If anyone has any good ideas on how to get the page numbers into the table of contents above that would be very helpfull.  So the output would look like the TOC from contents=yes in proc report (without dots preferably), but these would be linked directly to the first page of the relevant outputs:

i.e.

My link to cars  section                            2

My link to class section                            6

Thanks

Rob

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 270 views
  • 0 likes
  • 1 in conversation