Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Email SAS-通过%宏向电子邮件动态添加文本_Email_Macros_Sas_Sas Macro - Fatal编程技术网

Email SAS-通过%宏向电子邮件动态添加文本

Email SAS-通过%宏向电子邮件动态添加文本,email,macros,sas,sas-macro,Email,Macros,Sas,Sas Macro,我试图通过使用%宏来代替动态文本,在电子邮件中动态显示文本。这是可行的,但在我的电子邮件中添加了几行额外的文本后,它停止了工作。因此,我不确定是什么导致了实际问题。回到我工作时的状态不再有效 我打电话给我的宏: %macro PrintStuff(arrayOfThings); %local i next_element; %do i=1 %to %sysfunc(countw(&arrayOfThings)); %let next_element = %

我试图通过使用%宏来代替动态文本,在电子邮件中动态显示文本。这是可行的,但在我的电子邮件中添加了几行额外的文本后,它停止了工作。因此,我不确定是什么导致了实际问题。回到我工作时的状态不再有效

我打电话给我的宏:

%macro PrintStuff(arrayOfThings);
    %local i next_element;
    %do i=1 %to %sysfunc(countw(&arrayOfThings));
        %let next_element = %scan(&arrayOfThings, &i);
        %DO;
            %PUT "&next_element info is as follows:";
            %PUT "some text here";
            %PUT "some text there";
            %PUT "text all over!!!";
            %PUT "Do you even text?";
        %END;
    %end;
%mend PrintStuff;
电子邮件代码:

DATA _null_;
    File mailFile;
    PUT "This is email text. This shows up fine in the email";
    %PrintStuff(&someArray);
    PUT "This closes the email, and this shows up fine in the email when it is received!"
RUN;
我在这里试过几种不同的方法。我尝试在电子邮件中只包含%PrintStuff(&myArrayOrList)。我试过有结尾和没有结尾分号。我不知道哪里出了问题

代码成功运行后,日志以这种方式显示:

50         DATA _null_;
51          File outmail;
52          PUT "This is email text. This shows up fine in the email";
53         
54          %PrintStuff(&someArray)
"ResolvedElementName info is as follows:"
"some text here"
"some text there"
"some text all over!!!"
"Do you even text?"
55         
56          PUT "This closes the email, and this shows up fine in the email when it is received!";
57         RUN;

它起作用了,但现在不起作用了,我不确定它以前是怎么起作用的。任何建议都将不胜感激!!!提前谢谢

Put
在数据步骤中写入输出表/文件(即示例中的outmail),
%Put
在宏中写入日志。尝试将宏中的
%put
替换为
put
——它会将这5行添加到数据步骤中。

在数据步骤中,
put
写入
outmail
<代码>%PUT另一方面写入日志。我无法测试它,但尝试将宏中的
%put
替换为
put
@Petr非常感谢。成功了!如果你想写下来作为回答,我会接受的!