<?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 Re: ODS EXCEL - Anchors and links in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-EXCEL-Anchors-and-links/m-p/909102#M26455</link>
    <description>&lt;P&gt;Mentioned by Ksharp, linking with Excel is a little different than the other destinations.&amp;nbsp; The ANCHOR= option with ODS Excel is only applicable when using CSS stylesheets.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Dec 2023 16:31:34 GMT</pubDate>
    <dc:creator>Chevell_sas</dc:creator>
    <dc:date>2023-12-20T16:31:34Z</dc:date>
    <item>
      <title>ODS EXCEL - Anchors and links</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-EXCEL-Anchors-and-links/m-p/908883#M26453</link>
      <description>&lt;P&gt;The documentation&amp;nbsp;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/v_046/odsug/p09n5pw9ol0897n1qe04zeur27rv.htm#n1grgwzw0sek23n17nu6iug2r4f6" target="_blank" rel="noopener"&gt;SAS Help Center: ODS EXCEL&lt;/A&gt;&amp;nbsp;has an example that shows how to use the following statement&lt;/P&gt;&lt;PRE&gt;ODS EXCEL ANCHOR="anchor-name"&lt;/PRE&gt;&lt;P&gt;in conjunction with a style sheet, and it works great.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question: Can an anchor point be created 'inside' the output created by Proc REPORT, i.e. for a cell or string inside a compute block.&lt;/P&gt;&lt;P&gt;Question: Is there a statement or way to add a link in the output to anchor inside the same Excel file?&amp;nbsp; I.e. in HTML parlance, click on link 'X' and go to anchor '#X'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This detailed example shows the linkages (that work in HTML) that I hope to achieve in ODS EXCEL.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data links;
  length topic link1 link2 $20 ;
  input topic link1 link2 ;
  datalines;
Cars    Ford   Volkswagen
Class   James  Mary
Stocks  Intel  Microsoft
;

%let excel = * ods excel ;
%let excel =   ods excel ;

ods escapechar '^';

ods html path='c:\temp' file='demo.html' style=plateau;
&amp;amp;excel file='c:\temp\demo.xlsx' style=plateau;

&amp;amp;excel options(sheet_name="Summary");
proc report data=links;
  column topic link1 link2;
  compute topic;
    call define ('topic', 'url', '#' || trim(topic)) ;
  endcomp;
  compute link1;
    call define ('link1', 'url', '#' || trim(lowcase(topic)) || '_'  || trim(link1));
  endcomp;
  compute link2;
    call define ('link2', 'url', '#' || trim(lowcase(topic)) || '_'  || trim(link2));
  endcomp;
run;

&amp;amp;excel options(sheet_name="Cars");
ods text='^{dest [html] ^{raw &amp;lt;a name="Cars"&amp;gt;}} ^{newline 3} Custom narrative for CARS ^{dest [html]^{raw &amp;lt;/a&amp;gt;}} ^{newline 4}';
title "Cars";
proc report data=sashelp.cars ; 
  where type='Sedan' and drivetrain = 'Rear' and mpg_city &amp;gt; 19 or mpg_city &amp;lt; 13 ;
  column make make_anchor model type origin drivetrain ;
  define make / order noprint ;
  define make_anchor / 'Make' computed style=[protectspecialchars=off] ;
  compute make_anchor / character length=100 ; 
    if make ne ' ' then make_anchor = '&amp;lt;a name="cars_' || trim(make) || '"&amp;gt;' || trim(make) || '&amp;lt;/a&amp;gt;';
  endcomp ;
run;
  

&amp;amp;excel options(sheet_name="Class");
ods text='^{dest [html] ^{raw &amp;lt;a name="Class"&amp;gt;}}^{newline 3}Custom narrative for CLASS ^{dest [html] ^{raw &amp;lt;/a&amp;gt;}}^{newline 4}';
title "Class";
proc report data=sashelp.class; 
  column name name_anchor age sex height ;
  define name / order noprint;
  define name_anchor / 'Name' computed style=[protectspecialchars=off] ;
  compute name_anchor / character length=100; 
    if name ne ' ' then name_anchor = '&amp;lt;a name="class_' || trim(name) || '"&amp;gt;' || trim(name) || '&amp;lt;/a&amp;gt;';
  endcomp ;
run;

&amp;amp;excel options(sheet_name="Stocks");
ods text='^{dest [html] ^{raw &amp;lt;a name="Stocks"&amp;gt;}}^{newline 3}Custom narrative for STOCKS ^{dest [html] ^{raw &amp;lt;/a&amp;gt;}}^{newline 4}';
title "Stocks";
proc report data=sashelp.stocks;
  column stock stock_anchor date close volume ;
  where year(date) = 2005 and mod(month(date)-1,3)=0 ;
  define stock / order noprint ;
  define stock_anchor / computed style=[protectspecialchars=off] ;
  compute stock_anchor / character length=100;
    if stock ne ' ' then stock_anchor = '&amp;lt;a name="stocks_' || trim(stock) || '"&amp;gt;' || trim(stock) || '&amp;lt;/a&amp;gt;';
  endcomp ;
run;

ods _all_ close ;

/*
* Documentation example ;
filename css 'c:\temp\xl.css';
data _null_ ; file css ; input ; put _infile_ ; datalines ;
#Expense .header { background-color:green }
#Reports .header { background-color:red }
;
ods _all_ close;
ods excel file="c:\temp\demo.xlsx" options(sheet_interval="none") ; * cssstyle=css ;
ods excel anchor="expense";
proc print data=sashelp.class;
run;
ods excel anchor="reports" ; * cssstyle=css ;
proc print data=sashelp.class;
run;
ods excel close;
*/;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Tue, 19 Dec 2023 19:13:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-EXCEL-Anchors-and-links/m-p/908883#M26453</guid>
      <dc:creator>RichardAD</dc:creator>
      <dc:date>2023-12-19T19:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: ODS EXCEL - Anchors and links</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-EXCEL-Anchors-and-links/m-p/908987#M26454</link>
      <description>&lt;A href="https://communities.sas.com/t5/ODS-and-Base-Reporting/Create-Excel-with-Links-to-another-Sheet/m-p/814521" target="_blank"&gt;https://communities.sas.com/t5/ODS-and-Base-Reporting/Create-Excel-with-Links-to-another-Sheet/m-p/814521&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;If you want link another excel from this excel, &lt;BR /&gt;use &lt;BR /&gt;call define(_col_,'url',' c:\temp\have.xlsx#Sheet1!A1 ' );</description>
      <pubDate>Wed, 20 Dec 2023 09:30:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-EXCEL-Anchors-and-links/m-p/908987#M26454</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-12-20T09:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: ODS EXCEL - Anchors and links</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-EXCEL-Anchors-and-links/m-p/909102#M26455</link>
      <description>&lt;P&gt;Mentioned by Ksharp, linking with Excel is a little different than the other destinations.&amp;nbsp; The ANCHOR= option with ODS Excel is only applicable when using CSS stylesheets.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 16:31:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-EXCEL-Anchors-and-links/m-p/909102#M26455</guid>
      <dc:creator>Chevell_sas</dc:creator>
      <dc:date>2023-12-20T16:31:34Z</dc:date>
    </item>
  </channel>
</rss>

