The SAS Output Delivery System and reporting techniques

ODS PDF hyperlinks showing as html tags example: <a href='abc.pdf'> The ABC PDF file </a>

Reply
Contributor
Posts: 40

ODS PDF hyperlinks showing as html tags example: <a href='abc.pdf'> The ABC PDF file </a>

I am trying to create a PDF file using ODS PDF containing proc report. This proc report is within a macro having 2 parameters for different employee. One of the columns uses format= option where the format obtained from a dataset having a column with the href text as below.

 

I am using this in the proc sql to obtain the dynamic hyperlink format

"<a href='R"||trim(left(put(id,3.)))||".pdf'>"||trim(left(put(id,3.)))||'-'||trim(left(projname))||' ['||trim(left(status))||']'||"</a>" as label

 

ODS HTML shows fine with the hyperlink. However, using the same code with ODS PDF the hyperlink does not show up, instead I see the actual text/tags like this:

<a href='abc.pdf'> The ABC PDF file </a>

 

How can I get the PDF to show the hyperlink within each row for the entire column. The hyperlink is basically the pdf files stored in previous steps. I remember doing similar kind long time ago, but can't able to wrap my head around to figure this out googling.

 

can someone please help? Thanks.

Grand Advisor
Posts: 9,593

Re: ODS PDF hyperlinks showing as html tags example: <a href='abc.pdf'> The ABC PDF file </

ods pdf file='/folders/myfolders/x.pdf';
proc report data=sashelp.class nowd;
column name sex age;
define age/display;
compute age;
 if age=11 then call define(_col_,'url','/folders/myfolders/test.pdf');
endcomp;
run;
ods pdf close;
SAS Super FREQ
Posts: 8,721

Re: ODS PDF hyperlinks showing as html tags example: <a href='abc.pdf'> The ABC PDF file </

Hi:

  ODS PDF uses the URL style attribute as shown in Ksharp's example. PDF uses a "plain" URL, and doesn't use an <A> tag like HTML. Here's another couple of examples that illustrate how to create a "fixed" URL link (as for the NAME column header) that goes to www.google.com and then how to make a dynamic URL, such as for each value for name where the URL is:

https://www.google.com/#q=?????? , where ????? is replaced with the name for each row.

 

cynthia

 

** method 1;
proc format;
  value $urlnm 'Alfred'='https://www.google.com/#q=Alfred'
               'Alice'='https://www.google.com/#q=Alice'
	       'Barbara'='https://www.google.com/#q=Barbara'
               other = 'http://www.sas.com';
run;

ods pdf file='c:\temp\url1.pdf' notoc;

proc report data=sashelp.class;
  column name age height weight;
  define name / order 'Click for the Name'
     style(header)={url='http://www.google.com'}
     style(column)={url=$urlnm.};
run;
ods pdf close;


** method 2;
ods pdf file='c:\temp\url2.pdf' notoc;

proc report data=sashelp.class;
  column name age height weight;
  define name / order 'Click for the Name'
     style(header)={url='http://www.google.com'};

  compute name;
    length uvar $100;
	uvar=catt('https://www.google.com/#q=',name);
    call define(_col_,'url',uvar);
  endcomp;
run;
ods pdf close;
Ask a Question
Discussion stats
  • 2 replies
  • 370 views
  • 2 likes
  • 3 in conversation