<?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: Dynamic hyperlinking of cell data in different sheets in an excel based on values in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Dynamic-hyperlinking-of-cell-data-in-different-sheets-in-an/m-p/924939#M83418</link>
    <description>&lt;P&gt;Of course, You can.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
Yes. You can.
You need to save these positions firstly.
*/
data sheet1;
input a $;
cards;
123
234
AAA
;
data sheet2;
input a b c d $;
cards;
1 2 3 AAA
1 2 3 910
1 2 3 123
1 2 3 234
;

data _null_;
 set sheet2;
 call symputx(cats('_',d),_n_+1);
run;
ods excel file='c:\temp\temp.xlsx';
ods excel options(sheet_name='Sheet1');
proc report data=sheet1 nowd;
define a/display;
compute a;
 urlstring= cats("#Sheet2!D",symget(cats('_',a)));
 call define(_col_,'URL',urlstring);
 call define(_col_,'style','style={textdecoration=underline color=blue}');
endcomp;
run;


ods excel options(sheet_name='Sheet2');
proc report data=sheet2 nowd;
run;
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 19 Apr 2024 02:57:14 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2024-04-19T02:57:14Z</dc:date>
    <item>
      <title>Dynamic hyperlinking of cell data in different sheets in an excel based on values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Dynamic-hyperlinking-of-cell-data-in-different-sheets-in-an/m-p/924921#M83416</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I am looking for some help on how to hyperlink between excel sheet 1 cell data to excel sheet 2 cell data – both excel sheets can have values in random cells (of column A &amp;amp; D), I want to Match the values &amp;amp; hyperlink between those matched cells. Ex: as given below, this data can vary from report to report so I want to keep this match &amp;amp; link dynamic. Can this be achieved with sas code?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VA1_1-1713474057533.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/95672i7292D8262C8E746D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="VA1_1-1713474057533.png" alt="VA1_1-1713474057533.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Right now I am just able to hyperlink to certain cell in Sheet 2 in proc report, not by values.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;compute r_id;
	  urlstring= "#'"||strip('Rules')||"'!A2";
	  call define(_col_,'URL',urlstring);
	  call define(_col_,'style','style={textdecoration=underline color=blue}');
endcomp; &lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Apr 2024 21:04:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Dynamic-hyperlinking-of-cell-data-in-different-sheets-in-an/m-p/924921#M83416</guid>
      <dc:creator>VA1</dc:creator>
      <dc:date>2024-04-18T21:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic hyperlinking of cell data in different sheets in an excel based on values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Dynamic-hyperlinking-of-cell-data-in-different-sheets-in-an/m-p/924939#M83418</link>
      <description>&lt;P&gt;Of course, You can.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
Yes. You can.
You need to save these positions firstly.
*/
data sheet1;
input a $;
cards;
123
234
AAA
;
data sheet2;
input a b c d $;
cards;
1 2 3 AAA
1 2 3 910
1 2 3 123
1 2 3 234
;

data _null_;
 set sheet2;
 call symputx(cats('_',d),_n_+1);
run;
ods excel file='c:\temp\temp.xlsx';
ods excel options(sheet_name='Sheet1');
proc report data=sheet1 nowd;
define a/display;
compute a;
 urlstring= cats("#Sheet2!D",symget(cats('_',a)));
 call define(_col_,'URL',urlstring);
 call define(_col_,'style','style={textdecoration=underline color=blue}');
endcomp;
run;


ods excel options(sheet_name='Sheet2');
proc report data=sheet2 nowd;
run;
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Apr 2024 02:57:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Dynamic-hyperlinking-of-cell-data-in-different-sheets-in-an/m-p/924939#M83418</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-04-19T02:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic hyperlinking of cell data in different sheets in an excel based on values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Dynamic-hyperlinking-of-cell-data-in-different-sheets-in-an/m-p/925867#M83423</link>
      <description>&lt;P&gt;Thanks Ksharp!&lt;/P&gt;&lt;P&gt;Your code worked smoothly! However, I didn't quite understand how symput/symget worked in this case, value matching and hyperlinking? Could you please explain a little?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;VA1&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2024 18:52:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Dynamic-hyperlinking-of-cell-data-in-different-sheets-in-an/m-p/925867#M83423</guid>
      <dc:creator>VA1</dc:creator>
      <dc:date>2024-04-25T18:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic hyperlinking of cell data in different sheets in an excel based on values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Dynamic-hyperlinking-of-cell-data-in-different-sheets-in-an/m-p/925919#M83425</link>
      <description>"call symputx(cats('_',d),_n_+1);"&lt;BR /&gt;Here I make four macro variables from dataset 'Sheet2';&lt;BR /&gt;Macro_Var_Name  Macro_Var_Value&lt;BR /&gt;_AAA                         2&lt;BR /&gt;_910                           3&lt;BR /&gt;_123                            4&lt;BR /&gt;234                              5&lt;BR /&gt;&lt;BR /&gt;You see 2,3,4,5 correspond to the row number of D column in Sheet2.&lt;BR /&gt;&lt;BR /&gt;" urlstring= cats("#Sheet2!D",symget(cats('_',a)));"&lt;BR /&gt;Function cats('_',a) make a string like : '_123'  ,  '_234'  , '_AAA'  from Sheet1.&lt;BR /&gt;Function symget('_AAA') means get the value of macro variable _AAA , same as '_123'  ,  '_234' .&lt;BR /&gt;So when a='AAA' in Sheet1, I could get macro variable _AAA 's value 2. And urlstring= "#Sheet2!D2".&lt;BR /&gt;And I make a URL on the cell (a='AAA' in Sheet1)  by "call define(_col_,'URL','#Sheet2!D2');" which redirect to Sheet2 's D2 cell.&lt;BR /&gt;</description>
      <pubDate>Fri, 26 Apr 2024 01:27:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Dynamic-hyperlinking-of-cell-data-in-different-sheets-in-an/m-p/925919#M83425</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-04-26T01:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic hyperlinking of cell data in different sheets in an excel based on values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Dynamic-hyperlinking-of-cell-data-in-different-sheets-in-an/m-p/926039#M83428</link>
      <description>&lt;P&gt;Got it! Thanks so much for explaining!&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 15:37:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Dynamic-hyperlinking-of-cell-data-in-different-sheets-in-an/m-p/926039#M83428</guid>
      <dc:creator>VA1</dc:creator>
      <dc:date>2024-04-26T15:37:19Z</dc:date>
    </item>
  </channel>
</rss>

