<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Hyperlinks within text string - Export to Excel in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Hyperlinks-within-text-string-Export-to-Excel/m-p/993299#M26987</link>
    <description>&lt;P&gt;I have created a macro variable to hold a hyperlink:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let CT_link = &lt;A href="https://controller.vcu.edu/grants/;" target="_blank"&gt;https://controller.vcu.edu/grants/;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the PROC REPORT to generate the report.&amp;nbsp; I try to embed that hyperlink into a block of text using the Line Statement:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;line @1 'deadline ^{style [url="&amp;amp;ct_link" linkcolor=white]via the ^{style [color=blue textdecoration=underline]cost transfer form} available on the G&amp;amp;C webpage.} ';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We then have a parameter to specify if the report should be output as either PDF or EXCEL.&amp;nbsp; When the report is written as PDF, the hyperlink works fine:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jlwatts_0-1788958681923.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/117644i4B1907B5B04521F6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jlwatts_0-1788958681923.png" alt="jlwatts_0-1788958681923.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; But when I export the report to EXCEL, the hyperlink does not work:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jlwatts_1-1788958758782.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/117645i9CCB7BEEBB612958/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jlwatts_1-1788958758782.png" alt="jlwatts_1-1788958758782.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to embed the hyperlink in a line of text to have it work both in PDF and EXCEL format?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code that we include to allow selection between PDF, EXCEL or HTML:&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;if upcase("&amp;amp;outtype") = "HTML" then call symput("odsdest","HTML");&lt;BR /&gt;if upcase("&amp;amp;outtype") = "PDF" then do;&lt;BR /&gt;rc = stpsrv_header('Content-type','application/pdf');&lt;BR /&gt;rc = stpsrv_header('Content-disposition','attachment; filename=temp.pdf');&lt;BR /&gt;call symput("odsdest","PDF");&lt;BR /&gt;end;&lt;BR /&gt;if upcase("&amp;amp;outtype") = "EXCEL" then do;&lt;BR /&gt;rc = stpsrv_header('Content-type','application/vnd.ms-excel;');&lt;BR /&gt;rc = stpsrv_header('Content-disposition','attachment; filename=temp.xls');&lt;BR /&gt;call symput("odsdest","tagsets.excelxp");&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Sep 2026 13:06:01 GMT</pubDate>
    <dc:creator>jlwatts</dc:creator>
    <dc:date>2026-09-09T13:06:01Z</dc:date>
    <item>
      <title>Hyperlinks within text string - Export to Excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Hyperlinks-within-text-string-Export-to-Excel/m-p/993299#M26987</link>
      <description>&lt;P&gt;I have created a macro variable to hold a hyperlink:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let CT_link = &lt;A href="https://controller.vcu.edu/grants/;" target="_blank"&gt;https://controller.vcu.edu/grants/;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the PROC REPORT to generate the report.&amp;nbsp; I try to embed that hyperlink into a block of text using the Line Statement:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;line @1 'deadline ^{style [url="&amp;amp;ct_link" linkcolor=white]via the ^{style [color=blue textdecoration=underline]cost transfer form} available on the G&amp;amp;C webpage.} ';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We then have a parameter to specify if the report should be output as either PDF or EXCEL.&amp;nbsp; When the report is written as PDF, the hyperlink works fine:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jlwatts_0-1788958681923.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/117644i4B1907B5B04521F6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jlwatts_0-1788958681923.png" alt="jlwatts_0-1788958681923.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; But when I export the report to EXCEL, the hyperlink does not work:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jlwatts_1-1788958758782.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/117645i9CCB7BEEBB612958/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jlwatts_1-1788958758782.png" alt="jlwatts_1-1788958758782.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to embed the hyperlink in a line of text to have it work both in PDF and EXCEL format?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code that we include to allow selection between PDF, EXCEL or HTML:&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;if upcase("&amp;amp;outtype") = "HTML" then call symput("odsdest","HTML");&lt;BR /&gt;if upcase("&amp;amp;outtype") = "PDF" then do;&lt;BR /&gt;rc = stpsrv_header('Content-type','application/pdf');&lt;BR /&gt;rc = stpsrv_header('Content-disposition','attachment; filename=temp.pdf');&lt;BR /&gt;call symput("odsdest","PDF");&lt;BR /&gt;end;&lt;BR /&gt;if upcase("&amp;amp;outtype") = "EXCEL" then do;&lt;BR /&gt;rc = stpsrv_header('Content-type','application/vnd.ms-excel;');&lt;BR /&gt;rc = stpsrv_header('Content-disposition','attachment; filename=temp.xls');&lt;BR /&gt;call symput("odsdest","tagsets.excelxp");&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2026 13:06:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Hyperlinks-within-text-string-Export-to-Excel/m-p/993299#M26987</guid>
      <dc:creator>jlwatts</dc:creator>
      <dc:date>2026-09-09T13:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: Hyperlinks within text string - Export to Excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Hyperlinks-within-text-string-Export-to-Excel/m-p/993321#M26988</link>
      <description>Hi: It looks like you're running a stored process and using the older TAGSETS.EXCELXP. You could start to work with Tech Support to figure out why your link does not work or you could consider switching to the newer Open XML Excel format, an XLSX file, which is created with ODS EXCEL (as an alternative to TAGSETS.EXCELXP). This would also mean changing your STPSRV_HEADER statements for content-type and content-disposition -- this previous Forum posting shows the content-disposition that should be used for an XLSX file: &lt;A href="https://communities.sas.com/t5/SAS-Programming/Proc-HTTP-Content-Type-for-XLS-and-XLSX/td-p/552737" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Proc-HTTP-Content-Type-for-XLS-and-XLSX/td-p/552737&lt;/A&gt;&lt;BR /&gt;I don't have access to a configuration to test any stored process code however, if you are still stuck with the problem after trying an XLSX file, then working with Tech Support is your best resource.&lt;BR /&gt;Cynthia</description>
      <pubDate>Wed, 09 Sep 2026 15:07:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Hyperlinks-within-text-string-Export-to-Excel/m-p/993321#M26988</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2026-09-09T15:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Hyperlinks within text string - Export to Excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Hyperlinks-within-text-string-Export-to-Excel/m-p/993325#M26989</link>
      <description>&lt;P&gt;Are you sure that is the code you ran?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;line @1 'deadline ^{style [url="&amp;amp;ct_link" linkcolor=white]via
 the ^{style [color=blue textdecoration=underline]cost transfer form}
 available on the G&amp;amp;C webpage.} ';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Because the use of single quotes around the string will prevent the macro processor from replacing the reference to the CT_LINK macro variable with its value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try using double quotes instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;line @1 "deadline ^{style [url='&amp;amp;ct_link' linkcolor=white]via
 the ^{style [color=blue textdecoration=underline]cost transfer form}
 available on the G&amp;amp;C webpage.} ";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It will also prevent the macro processor from replacing the reference to the C macro variable with its value.&amp;nbsp; But you did not provide a value for that one.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2026 16:00:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Hyperlinks-within-text-string-Export-to-Excel/m-p/993325#M26989</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-09-09T16:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: Hyperlinks within text string - Export to Excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Hyperlinks-within-text-string-Export-to-Excel/m-p/993373#M26990</link>
      <description>&lt;P&gt;In Excel file, the URL only can apply to a whole cell, not just a part of line .&lt;/P&gt;
&lt;P&gt;Interesting thing is the URL seems to be unable to apply to LINE statement, I don't know why .&lt;/P&gt;
&lt;P&gt;But FOOTNOTE could make a workaround way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let CT_link = https://controller.vcu.edu/grants/;
ods escapechar='^';
&lt;STRONG&gt;ods excel file='c:\temp\temp.xlsx' options(Sheet_Name='xx' Embedded_footnotes='yes');
footnote  j=l link="&amp;amp;ct_link" 'deadline ^{style [textdecoration=underline color=blue]cost transfer form} available on the G&amp;amp;C webpage.' ;
&lt;/STRONG&gt;
proc report data=sashelp.class nowd;
run;
ods excel close;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1789005124872.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/117696i13D17A2D58C0973F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1789005124872.png" alt="Ksharp_0-1789005124872.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2026 01:52:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Hyperlinks-within-text-string-Export-to-Excel/m-p/993373#M26990</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2026-09-10T01:52:46Z</dc:date>
    </item>
  </channel>
</rss>

