BookmarkSubscribeRSS Feed
Suzy_Cat
Pyrite | Level 9

Hello helpers,

 

I have tried to look for solutions but could not find any that could resolve the problem that I have.

The email sent automatically when production completed. Although the link shows correct file path when you hover around it, it will not direct to the correct path. 

When copy the hyperlink from the email, it replaces "\" and space in the path, i.e. "file%3A%5C%5C".

 

Can anyone advise how to make the hyperlink work?

 

Test script:



%macro email_test_link(DS);

/*set the folder for hyperlink in the email*/
%let nobs=%eval(0) ;
proc sql noprint;
	select nobs into :nobs
	from dictionary.tables
	where libname = 'WORK' and memname = %sysfunc(upcase("&ds"));
quit;

* Send email to developer for log check;
filename mymail email 
to=(&email_to.)
TYPE='TEXT/HTML'
SUBJECT = "Production log check complete on &SYSDAY &SYSDATE9"
;

data _null_;
	file mymail;
	put '<html><head>';
	put '<style type="text/css" MEDIA=screen><!--';
	put 'body { color: #346170; font-family: Verdana; font-size: 12pt; }';
	put '.errorMessage { color: Red; font-size: 16pt; }'; 
	put '--></style></head><body>';
	put "Hello -<br/> <br/> production is complete.";
	put "<br/><br/>";
	put "Check data outputs in the daily folder:";
	put '<ul><li>';
	put "<a href=&daily_data.>links</a>";
	put "<br/></li></ul>";
	put '<ul><li>';
	put "Total records for &DS: &nobs <br><br>";
	put "<br/></li></ul>";
	%if &nobs = 0 %then %do;
		put '<ul><li><span class="errorMessage">';
		put 'Process may failed, check required!';
		put "</span>";
		put "<br/></li></ul>";
	%end;
	put '</body></html>';
	put "<br><br>";
	put "--------------------------------------------------------------------------------------------------<br>";
	put "Job Started Execution at:  &STARTTIME_Char and completed at: &CompletedTime_Char <br>";
	put "SAS session started running at: &systime on &SYSDAY &SYSDATE9";
run; 

%mend email_test_link;



%let daily_data = %sysfunc(URLENCODE(file:\\xx\HomeDir$\xx\Downloads\)); 
%let email_to=%str("xxx@xx.xx.xx" );

data test;
a="HHAAHA";
run;


%email_test_link(test);
9 REPLIES 9
andreas_lds
Jade | Level 19

Blind guess:

Add some quotes:

put "<a href='&daily_data.'>links</a>";

and change the \ to / when setting daily_data.

Suzy_Cat
Pyrite | Level 9
Hey Thanks ... forgot to mention that I have already tried the "/"
Suzy_Cat
Pyrite | Level 9
Will try and see
Suzy_Cat
Pyrite | Level 9
Hi Kurt,

Thanks for the option.

Have tested all different slash options for daily_data together with your suggestion, unfortunately I have no luck yet.
Suzy_Cat
Pyrite | Level 9
Hi Kurt, Thanks for your help.

It is weird that I no longer receive the SAS communities notification email..

Windows 10 Enterprise
Office 365 Outlook
Kurt_Bremser
Super User

I played around with it (Apple mail client on a Mac). https: links are properly recognized and handed off to the browser, but the file: link needs to be right-clicked to call up the context menu containing "Open with...".

Suzy_Cat
Pyrite | Level 9
sad I can not do that on my laptop

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 9 replies
  • 1741 views
  • 3 likes
  • 3 in conversation