<?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: Create Excel with Links to another Sheet in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Create-Excel-with-Links-to-another-Sheet/m-p/814543#M25804</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods excel file='c:\temp\want.xlsx' options(sheet_name='class');
proc report data=sashelp.class nowd;
compute name;
n+1;
if n in (2 8 12) then do;
call define(_col_,'url',' #car!A1 ' );
call define(_col_,'style','style={textdecoration=underline color=blue}');
end;
endcomp;
run;
ods excel  options(sheet_name='car');
proc report data=sashelp.heart(obs=20) nowd;
columns status weight height bp_status;
compute status;
n+1;
if n in (2 8 12) then do;
call define(_col_,'url',' #class!A1 ' );
call define(_col_,'style','style={textdecoration=underline color=blue}');
end;
endcomp;
run;
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Whatever. Here is an example .&lt;/P&gt;</description>
    <pubDate>Sat, 21 May 2022 10:10:40 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2022-05-21T10:10:40Z</dc:date>
    <item>
      <title>Create Excel with Links to another Sheet</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Create-Excel-with-Links-to-another-Sheet/m-p/814521#M25800</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to generate an Excel workbook that has a summary page with links to other sheets.&lt;/P&gt;
&lt;P&gt;This is part of a DQ process that creates an Excel which then gets attached to a decision node in a workflow for users to decide if the process can proceed or if there is a need to first fix the data and re-run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I'm trying to generate is a link like one could create manually in Excel.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1653099466049.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71679i7DEA9FD12153BEE6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1653099466049.png" alt="Patrick_0-1653099466049.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is this possible using SAS? And if yes can you please point me to the right place in the docu or even better some white paper with a sample script. I couldn't find anything so far.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm almost certain I could make this work using Python but I'd like to use SAS if possible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Patrick&lt;/P&gt;</description>
      <pubDate>Sat, 21 May 2022 08:37:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Create-Excel-with-Links-to-another-Sheet/m-p/814521#M25800</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-05-21T08:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: Create Excel with Links to another Sheet</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Create-Excel-with-Links-to-another-Sheet/m-p/814540#M25801</link>
      <description>&lt;P&gt;Yes. You can do. Here is an example. All you need to do is make a URL style like:&lt;/P&gt;
&lt;P&gt;call define(_col_,'url',cats('#''',Sheet1,'''!A1') );&lt;/P&gt;
&lt;P&gt;Here "Sheet1" is Sheet Name(put # before it). "A1" is the cell you want to point inside Sheet1.&lt;/P&gt;
&lt;P&gt;Also I pack my code as a attachment, you can run it to know how it work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good Luck!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path=%sysfunc(prxchange(s/[^\\]+$//,1,%sysget(SAS_EXECFILEPATH)));
options validvarname=any validmemname=extend;
%put &amp;amp;path ;
/***导入需要保留的 受试者**/
proc import datafile="&amp;amp;path.\01批datalisting106名受试者.xlsx" out=_have_ dbms=xlsx replace;
run;

/*原始excel*/
*libname x xlsx "&amp;amp;path.\ODM_Datasets_XLS_Site-All_zh-CN_20210113114550(1).xlsx";
libname x excel "&amp;amp;path.\ODM_Datasets_XLS_Site-All_zh-CN_20210113114550(1).xlsx";

proc sql noprint;
create table _dsn_ as
select nliteral(memname) as memname,sum(upcase(name)='SUBJECT_ID') as flag 
  from dictionary.columns
   where libname='X'
    group by memname
     order by flag,input(compress(memname,,'kd'),best.);
quit;
data _null_;
 set _dsn_ end=last;
 if _n_=1 then call execute('proc sql;');
 if flag then call execute(cat('create table _',compress(memname,,'kad'),' as select * from x.',memname,
              ' where subject_id="筛选号" or subject_id in (select subject_id from _have_);'));
	else call execute(cat('create table _',compress(memname,,'kad'),' as select * from x.',memname,';'));
 if last then call execute('quit;');
run;


/*Copy 数据到 另一个excel中*/
ods _all_ close;
data _null_;
 set _dsn_ end=last;
 if _n_=1 then call execute('ods excel file="&amp;amp;path.\需要保留的受试者数据.xlsx" ;');
 if find(memname,'eCRF表单','i') then 
    call execute(catt("ods excel options(sheet_name='",scan(memname,1,'"''$&amp;amp; ',),"') ;
                       proc report data=_",compress(memname,,'kad')," nowd;
                       compute 表单名称;
 call define(_col_,'url',cats('#''',表单代码,'''!A1') );
 call define(_col_,'style','style={textdecoration=underline color=blue}');
endcomp;
                       run;"  ));
else do;
 call execute(catt("ods excel options(sheet_name='",scan(memname,1,'"''$',),"') ;"));
 call execute(catt('proc report data=_',compress(memname,,'kad'),' nowd;run;' ));
end;
 if last then call execute('ods excel close;');
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 21 May 2022 09:57:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Create-Excel-with-Links-to-another-Sheet/m-p/814540#M25801</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-05-21T09:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: Create Excel with Links to another Sheet</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Create-Excel-with-Links-to-another-Sheet/m-p/814541#M25802</link>
      <description>Here is an example :&lt;BR /&gt;&lt;BR /&gt;call define(_col_,'url',' #Sheet2!A1 '  );&lt;BR /&gt;&lt;BR /&gt;It stands for this cell could link to A1 of Sheet2 .</description>
      <pubDate>Sat, 21 May 2022 10:02:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Create-Excel-with-Links-to-another-Sheet/m-p/814541#M25802</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-05-21T10:02:29Z</dc:date>
    </item>
    <item>
      <title>Re: Create Excel with Links to another Sheet</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Create-Excel-with-Links-to-another-Sheet/m-p/814542#M25803</link>
      <description>call define(_col_,'style','style={textdecoration=underline color=blue}');&lt;BR /&gt;&lt;BR /&gt;This could make the cell like have a link .</description>
      <pubDate>Sat, 21 May 2022 10:04:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Create-Excel-with-Links-to-another-Sheet/m-p/814542#M25803</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-05-21T10:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: Create Excel with Links to another Sheet</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Create-Excel-with-Links-to-another-Sheet/m-p/814543#M25804</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods excel file='c:\temp\want.xlsx' options(sheet_name='class');
proc report data=sashelp.class nowd;
compute name;
n+1;
if n in (2 8 12) then do;
call define(_col_,'url',' #car!A1 ' );
call define(_col_,'style','style={textdecoration=underline color=blue}');
end;
endcomp;
run;
ods excel  options(sheet_name='car');
proc report data=sashelp.heart(obs=20) nowd;
columns status weight height bp_status;
compute status;
n+1;
if n in (2 8 12) then do;
call define(_col_,'url',' #class!A1 ' );
call define(_col_,'style','style={textdecoration=underline color=blue}');
end;
endcomp;
run;
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Whatever. Here is an example .&lt;/P&gt;</description>
      <pubDate>Sat, 21 May 2022 10:10:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Create-Excel-with-Links-to-another-Sheet/m-p/814543#M25804</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-05-21T10:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: Create Excel with Links to another Sheet</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Create-Excel-with-Links-to-another-Sheet/m-p/814588#M25805</link>
      <description>&lt;P&gt;That does the trick. Thank you! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I've been very close (based on an answer you've given for an earlier question) but missed how to correctly reference another sheet within the same Excel workbook.&lt;/P&gt;</description>
      <pubDate>Sun, 22 May 2022 02:13:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Create-Excel-with-Links-to-another-Sheet/m-p/814588#M25805</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-05-22T02:13:58Z</dc:date>
    </item>
  </channel>
</rss>

