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.
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;
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;
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.