Hi i am having a macro variable to send the email SEmailid I will write the email in one table from that it will pick it if i write for 1 email it was working user@email.com then it was working if i want to send to 2-3 users it was not going i have tryed this ways %SEmailid=user1@gmail.com;user2@gmail.com;user3@gmail.com; %SEmailid=%str(user1@gmail.com;user2@gmail.com;user3@gmail.com); %SEmailid="user1@gmail.com" "user2@gmail.com" "user3@gmail.com" %SEmailid='user1@gmail.com' 'user2@gmail.com' 'user3@gmail.com'. can any one help me it was resloving but i ma not getting email for one email i am getting if i am trying for 2-3 emial is it was getting problem
What is your correct code when you can send only one E-mail addresss?
%MACRO email(sEmailid); FILENAME mymail EMAIL "NULL" TO="&sEmailid" SUBJECT="&pSubject"; data _null_; FILE mymail; END; run; %MEND; I the table i will give the email in the table user1@gmail.com DATA _NULL_ ; CALL SYMPUT("pEmailid","&EMAIL_ID"); run; I am using DI 4.2
In your example, not all email addresses end with a semi-colon. That could be the problem. If they do all end with semi-colons, have your tried ending them with commas instead?
Tried semi colon(;) and comma(,) also....
I don't understand your code. Is that what you actually submit? You appear to create a macro, but don't call it and, rather, use call symput to create a macro variable.
Can you post two sets of code. First, an entire set that will successfully produce a single email and then another full set that fails with multiple emails?
Hi,
Two Possible ways that you can have a look at... Hope it helps
data a;
input mailid : $50. subject : $10.;
cards;
id1@mail.com test1
id2@mail.com test2
id3@mail.com test3
;
run;
*solution 1;
filename message email from = "mainid@mail.com";
data _null_;
file message;
set a;
put '!EM_TO!' mailid;
put '!EM_SUBJECT!' subject;
put "This is just a test";
put '!EM_SEND!';
put '!EM_NEWMSG!';
put '!EM_ABORT!';
run;
*Solution 2;
%MACRO email(pEmailid,psubject);
FILENAME mymail EMAIL
TO="&&pEmailid"
SUBJECT="&&pSubject"
from="mainid@mail.com" ct='text/html';
data _null_;
FILE mymail;
run;
%MEND;
DATA _NULL_ ;
set a;
call execute('%email('||mailid||' ,'||subject||')');
run;
%MACRO email(SEmailid); FILENAME mymail EMAIL "NULL" TO="&SEmailid" data _null_; FILE mymail; END; run; %MEND; OPTIONS MLOGIC MPRINT SYMBOLGEN; data _null_; set MailDset; call symput("V_EMAIL_ID",trim(EMAIL_ID)); run; DATA _NULL_ ; CALL SYMPUT("SEmailid","&V_EMAIL_ID"); RUN; %email(&SEmailid); We are having a Dataset mailDest in that we have a variable called Email_ID there now we have only one email id now we want to insert 2-3 email ids we have tryed by keeping semicolon,comma(,),space and in code but i am getting error
Hi,
Is your objective to send the same mail to all the Ids in your data set ?
Then something that works for me is
proc sql;
select distinct quote(strip(email_id)) into : semailid separated by " "
from maildest;
quit;
%MACRO email(SEmailid);
FILENAME mymail EMAIL
/*"NULL" */
TO=
(
&SEmailid
)
from="myid@mail.com";
data _null_;
FILE mymail;
/* END; */
run;
%MEND;
%email(&semailid);
But i want to add the Email in the Table only as this is server for the above i should change it in many things actually in the previously i have added in the table only ,now also i wnat to add in the table only
Please forgive me maybe i am unable to understand your problem...
Is it that you have a single cell in your table that will have all the emailids.....?
data maildset;
email_id = " 'id@mail.com' 'id2@mail.com' 'id3@mail.com' ";
run;
data _null_;
set MailDset;
call symput("SEmailid",trim(eMAIL_ID));
run;
%put &v_email_id;
%MACRO email(SEmailid);
FILENAME mymail EMAIL
/*"NULL" */
TO=
(
&SEmailid
);
data _null_;
FILE mymail;
/* END; */
run;
%MEND;
%email(&SEmailid);
If this does not help then probably you should post your log with the Mprint and Symbolgen so that the experts can look at it provide a solution.
yes i have tryed startingly only. Actually i am having a table in that email variable is there now i want to add the new variables in to that cell only i have tryed by semicolon(;),comma(,) ,space like that
It should be space with quotes. Please look at the sample that i have provided
data maildset;
email_id = " 'id@mail.com' 'id2@mail.com' 'id3@mail.com' ";
run;
However there seems to be a problem in the macro Email that you have defined.
You need to change the TO = your &semailid should be in brackets and not quote. Please check the sample provided above.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.