Reputation: 205
so I have a dataset whose elements are strings of emails in quotes. A single data element might look like this: "[email protected]" "[email protected]" "[email protected]" "[email protected]"
I have the following macro command and data step:
%macro Emailer(RCP=);
/* body of the e-mail*/
data _null_;
file tmp;
put "Hello, World! <BR>";
run;
/*to-from*/
Filename tmp Email
Subject="Hello World Test"
To= (&RCP)
CT= "text/html";
%mend Emailer;
data _null_;
set EmailLists;
call execute('%Emailer(RCP='||ListOfEmails||')');
run;
But I keep getting "ERROR: Macro parameter contains syntax error."
Is it because my data elements have spaces or quotation marks or both?
Thanks in advance.
Upvotes: 1
Views: 1300
Reputation: 10401
One way to test it is to pass the parameters directly, rather than with a data step. First I'll rearrange the order of the statements, as commenters pointed out.
%macro Emailer(RCP=);
filename myEmail Email;
data _null_;
file myEmail Subject = "Hello World Test"
To = (&RCP)
CT = "text/html";
put "Hello, World! <BR>";
run;
filename myEmail clear;
%mend Emailer;
And try making any of those work (can't make my 64-bit SAS work with my 32-bits Outlook so I can't test any of this):
%Emailer(RCP="[email protected]" "[email protected]" "[email protected]")
%Emailer(RCP="[email protected] [email protected] [email protected]")
%Emailer([email protected] [email protected] [email protected])
%Emailer([email protected] ; [email protected] ; [email protected])
After you figure out which form works, the rest should be easy.
Upvotes: 1