How to add hyperlinks to Microsoft Excel workbooks using the EXPORT procedure


When you use the EXPORT procedure to write to Excel workbooks, web hyperlinks might be displayed as character values. Here is an example:

data temp1;
length mylink $ 50;
input mylink $;
datalines;
www.sas.com
;
 
proc export data=temp1 outfile='c:\sastest\myhttp.xlsx'
dbms=excel;
sheet='mylinks';
run;

In this example, www.sas.com would be displayed as a character value. To resolve the problem, make sure that HTTP:// or HTTPS:// is added to the web hyperlink you are writing to Excel, as shown in this example:

data temp1;
length mylink $ 50;
input mylink $;
datalines;
http://www.sas.com
;
 
proc export data=temp1 outfile='c:\sastest\myhttp.xlsx'
dbms=excel;
sheet='mylinks';
run;

To make the hyperlinks active, do the one following after opening the Excel file.

Option 1

  1. Double-click the hyperlink cell that contains the web address.
  2. Click any other cell in the worksheet. This activates the hyperlink.

Option 2

  1. If you have multiple rows to make available, create a new column in Excel with a formula that uses a hyperlink similar to this =HYPERLINK(cell number)