Reputation: 35
I want to send an email from sas.
The body of the e-mail must have the link to the file location.
The I used the following sas code.
%let link = file:\\a\hello world\test\file location;
filename testmail email "[email protected]";
data _null_;
file testmail;
put &link;
run;
It is sending the email as expected but since there is a space in the address, the like gets broken at file:\a\hello
Any way around this?
Thanks in advance.
Upvotes: 0
Views: 1709
Reputation: 27508
Can you show the log output ?
A first fix to try is to double-quote the link in the put statement
put "&link";
instead of
put &link;
A second fix to try is to URL encode the link.
%let link = %sysfunc(URLENCODE(file:\\a\hello world\test\file location));
%* show encoded link in the log;
%put NOTE: &=link;
----- LOG -----
NOTE: LINK=file%3A%5C%5Ca%5Chello%20world%5Ctest%5Cfile%20location
Upvotes: 0
Reputation: 1396
Good day,
Sending email with SAS is a bit tricky. Here is a template that I've used mended to your purposes. It's not quite what you are after, but supports dynamic inputs.
%let resplist= [email protected];
%let RepPath= C:/test;
%let Repname= Result.csv
FILENAME Mailbox EMAIL &respList.
/* bcc=(&bccList.) Add any other delivery targets here. */
Subject="Test mail"
attach=("&RepPath.\&ReportName.")
type='text/html';
DATA _NULL_;
FILE Mailbox;
put "<body>";
put "<p>Good day,</p>" ;
put "<p>I am an automagic mail.<br>";
run;
Here are a few additional resources you might wish to take a look at SAS documentation A decent pdf on matter
Upvotes: 1