在SAS中的电子邮件中包含指向文件位置的链接

在SAS中的电子邮件中包含指向文件位置的链接,sas,Sas,我想从sas发送一封电子邮件 电子邮件正文必须具有指向文件位置的链接 我使用了下面的sas代码 %let link = file:\\a\hello world\test\file location; filename testmail email "test@test.com"; data _null_; file testmail; put &link; run; 它正在按预期发送电子邮件,但由于地址中有空格,因此在文件:\a\hello中类似的内容会被破坏 有

我想从sas发送一封电子邮件

电子邮件正文必须具有指向文件位置的链接

我使用了下面的sas代码

%let link = file:\\a\hello world\test\file location; 

filename testmail email "test@test.com";

data _null_; 
  file testmail; 
  put &link; 
run;
它正在按预期发送电子邮件,但由于地址中有空格,因此在文件:\a\hello中类似的内容会被破坏

有办法吗

提前谢谢

你好

用SAS发送电子邮件有点棘手。这是一个模板,我用它来修补你的目的。它不完全是你想要的,但支持动态输入

%let resplist= test@test.com;
%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;
%let resplist=test@test.com;
%让RepPath=C:/test;
%让Repname=Result.csv
文件名邮箱电子邮件和回复列表。
/*bcc=(&bccList.)在此处添加任何其他交付目标*/
主题=“测试邮件”
附加=(“&RepPath.\&ReportName.”)
type='text/html';
数据为空;
文件邮箱;
将“”改为“;
写上“你好,

”; 写上“我是一封自动邮件。
”; 跑

下面是一些您可能希望查看的附加资源

能否显示日志输出

尝试的第一个修复方法是在put语句中双引号引用链接

put "&link";
而不是

put &link;
第二种修复方法是对链接进行URL编码

%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

如果要链接到共享位置的文件,需要使用电子邮件fileref上的
type='text/html'
选项,并创建相应的链接<代码>。