BookmarkSubscribeRSS Feed
sas_university
Obsidian | Level 7

 

how to customize the send mails  personalization for each person, code is below , please anyone help on this .Where

-where we make changes on my code

-Customize for each person send message

 

 

EMP_ID EMP_NAME GENDER BIRTHDAY COMPANY DESIGN LOC MAIL_ID
100 VENKATA MALE 24/11/22 SAMA DIRECTOR PUNE ravindranadh2125@gmail.com
101 MURALI MALE 24/11/22 SAMA DEVELOPER PUNE ravindranadh2125@gmail.com
102 PRABHAKAR MALE 24/11/22 SAMA DOMAIN BANG ravindranadh2125@gmail.com
103 PRASANNA FEMALE 24/11/22 INFOTECH PROGRAMMER HYD ravindranadh2125@gmail.com
104 RAMYA FEMALE 26/11/22 GOOGLE DEVELOPER KOCHI ravindranadh2125@gmail.com
105 MOUNIKA FEMALE 23/11/22 MICROSOFT PROGRAMMER CHENNAI ravindranadh2125@gmail.com
106 KIRAN MALE 26/11/22 ACCENTURE ANALYST BANG ravindranadh2125@gmail.com
107 NIKIL MALE 25/11/22 WIPRO DEVELOPER MUMBAI ravindranadh2125@gmail.com
108 MANOHAR MALE 24/11/22 CYIENT PROGRAMMER HYD ravindranadh2125@gmail.com
109 RAVINDRA MALE 26/11/22 INFOSIS ANALYST PUNE ravindranadh2125@gmail.com
110 PAVAN MALE 25/11/22 SAMA PROGRAMMER CHENNAI ravindranadh2125@gmail.com
111 RAMANI FEMALE 24/11/22 ELI LILLY DEVELOPER KOCHI ravindranadh2125@gmail.com

 

 

options unbuflog;
proc import datafile="/home/u61914035/import files/birthdayXL.xlsx"
dbms=xlsx
out=ds
replace;
run;
data staff;
set ds;
informat BIRTHDAY ddmmyy10.;
format BIRTHDAY date9.;
where BIRTHDAY ne .;
todays=put(today(),date9.);
run;

data bday_today;
set staff;
bday=substr(put(BIRTHDAY,date9.),1,5);
tday=upcase(substr(todays,1,5));
if bday=tday;
run;

 

proc sql;
select count(distinct MAIL_ID) into :emailcnt from bday_today;
%let emailcnt = %cmpres(&emailcnt);
select distinct MAIL_ID into :email1 - :email&emailcnt from bday_today;
quit;

%macro mail;
%if &emailcnt gt 0 %then
%do i = 1 %to &emailcnt;
filename Myemail email
from = "ravindranadh044@gmail.com"
subject = "!!! BIRTHDAY ALERT !!!"
attach=("/home/u61914035/import files/0d01cc9cebe2e8de8b60d8fbf6ee47bc.gif")
to = "&&email&i"
type = "text/html";

data null;
file Myemail;
set bday_today(where = (MAIL_ID="&&email&i"));
put 'HAPPY BIRTHDAY' ;
RUN;
%end;
%mend;
%mail;

15 REPLIES 15
sas_university
Obsidian | Level 7

 

how to customize the text or document through mail to each persons who have bdays automatically without running the program daily...

 

 

EMP_ID EMP_NAME GENDER BIRTHDAY COMPANY DESIGN LOC MAIL_ID
100 VENKATA MALE 24/11/22 SAMA DIRECTOR PUNE ravindranadh2125@gmail.com
101 MURALI MALE 24/11/22 SAMA DEVELOPER PUNE ravindranadh2125@gmail.com
102 PRABHAKAR MALE 24/11/22 SAMA DOMAIN BANG ravindranadh2125@gmail.com
103 PRASANNA FEMALE 24/11/22 INFOTECH PROGRAMMER HYD ravindranadh2125@gmail.com
104 RAMYA FEMALE 26/11/22 GOOGLE DEVELOPER KOCHI ravindranadh2125@gmail.com
105 MOUNIKA FEMALE 23/11/22 MICROSOFT PROGRAMMER CHENNAI ravindranadh2125@gmail.com
106 KIRAN MALE 26/11/22 ACCENTURE ANALYST BANG ravindranadh2125@gmail.com
107 NIKIL MALE 25/11/22 WIPRO DEVELOPER MUMBAI ravindranadh2125@gmail.com
108 MANOHAR MALE 24/11/22 CYIENT PROGRAMMER HYD ravindranadh2125@gmail.com
109 RAVINDRA MALE 26/11/22 INFOSIS ANALYST PUNE ravindranadh2125@gmail.com
110 PAVAN MALE 25/11/22 SAMA PROGRAMMER CHENNAI ravindranadh2125@gmail.com
111 RAMANI FEMALE 24/11/22 ELI LILLY DEVELOPER KOCHI ravindranadh2125@gmail.com

 

 

options unbuflog;
proc import datafile="/home/u61914035/import files/birthdayXL.xlsx"
dbms=xlsx
out=ds
replace;
run;
data staff;
set ds;
informat BIRTHDAY ddmmyy10.;
format BIRTHDAY date9.;
where BIRTHDAY ne .;
todays=put(today(),date9.);
run;

data bday_today;
set staff;
bday=substr(put(BIRTHDAY,date9.),1,5);
tday=upcase(substr(todays,1,5));
if bday=tday;
run;

 

proc sql;
select count(distinct MAIL_ID) into :emailcnt from bday_today;
%let emailcnt = %cmpres(&emailcnt);
select distinct MAIL_ID into :email1 - :email&emailcnt from bday_today;
quit;

%macro mail;
%if &emailcnt gt 0 %then
%do i = 1 %to &emailcnt;
filename Myemail email
from = "ravindranadh044@gmail.com"
subject = "!!! BIRTHDAY ALERT !!!"
attach=("/home/u61914035/import files/0d01cc9cebe2e8de8b60d8fbf6ee47bc.gif")
to = "&&email&i"
type = "text/html";

data null;
file Myemail;
set bday_today(where = (MAIL_ID="&&email&i"));
put 'HAPPY BIRTHDAY' ;
RUN;
%end;
%mend;
%mail;

andreas_lds
Jade | Level 19

Please don't post questions multiple times.

Please post data in usable form: a data step using datalines.

When posting code, please use "insert sas code" (the button with the running person) and post properly formatted code only.

Form your description i don't understand what you want to achieve.

sas_university
Obsidian | Level 7
proc import datafile="/home/u61914035/import files/birthdayXL.xlsx"
dbms=xlsx
out=ds
replace;
run;
data staff;
set ds;
informat BIRTHDAY ddmmyy10.;
format BIRTHDAY date9.;
where BIRTHDAY ne .;
todays=put(today(),date9.);
run;

data bday_today;
set staff;
bday=substr(put(BIRTHDAY,date9.),1,5);
tday=upcase(substr(todays,1,5));
if bday=tday;
run;

 

proc sql;
select count(distinct MAIL_ID) into :emailcnt from bday_today;
%let emailcnt = %cmpres(&emailcnt);
select distinct MAIL_ID into :email1 - :email&emailcnt from bday_today;
quit;

%macro mail;
%if &emailcnt gt 0 %then
%do i = 1 %to &emailcnt;
filename Myemail email
from = "ravindranadh044@gmail.com"
subject = "!!! BIRTHDAY ALERT !!!"
attach=("/home/u61914035/import files/0d01cc9cebe2e8de8b60d8fbf6ee47bc.gif")
to = "&&email&i"
type = "text/html";

data null;
file Myemail;
set bday_today(where = (MAIL_ID="&&email&i"));
put 'HAPPY BIRTHDAY' ;
RUN;
%end;
%mend;
%mail;

 

Sorry for post  twice,
1.how to customize a mail for each Pearson
2.how to customize the text or document through mail to each persons who have bdays automatically
Kurt_Bremser
Super User

Simple approach:

Create a macro which sends one email to one person. It should accept the email address as parameter.

Then read yor initial dataset, and for every observation where day(birthday) = day(today()) and month(birthday) = month(today()) call the macro with CALL EXECUTE.

Kurt_Bremser
Super User

Define "customize". Show examples of the text for different persons. Provide example data supplying the items for customization.

For code, provide example data in a data step with datalines. DO NOT SKIP THIS.

sas_university
Obsidian | Level 7

data ds;

infile datalines;

input EMP_ID EMP_NAME$   GENDER$  BIRTHDAY COMPANY$  DESIGN$  LOC $  MAIL_ID$ 1 -26;

cards;

100   venkata     male        27/11/2022    sama    director        pune       ravindranadh2125@gmail.com

101   murali        male        28/11/2022    sama    teamlead     pune      ravindranadh2125@gmail.com

102  prabhkar     male       27/11/2022   sama      manager     pune       ravindranadh2125@gmail.com

103  prasanna    female    27/11/2022  infotech    juniordev    hyd          ravindranadh2125@gmail.com

104  ramya         female    27/11/2022  infotech     juniordev   chennai   ravindranadh2125@gmail.com

105 mounika      female    28/11/2022  google       juniordev    hyd          ravindranadh2125@gmail.com

106  kiran           male       29/11/2022   google      juniordev    hyd          ravindranadh2125@gmail.com

107 nikhil           male        28/11/2022   cyient       juniordev   bang        ravindranadh2125@gmail.com

108 manohar     male        28/11/2022   infosis      juniordev    bang       ravindranadh2125@gmail.com

109  ravindra     male         27/11/2022    infosis    juniordev    hyd         ravindranadh2125@gmail.com

110  pavan        male         27/11/2022      sama     juniordev    pune        ravindranadh2125@gmail.com

111 ramani        male         27/11/2022     eli llily     juniordev    vizag       ravindranadh2125@gmail.com

 ;

run;

proc import datafile="/home/u61914035/import files/birthdayXL.xlsx"
dbms=xlsx
out=ds
replace;
run;
data staff;
set ds;
informat BIRTHDAY ddmmyy10.;
format BIRTHDAY date9.;
where BIRTHDAY ne .;
todays=put(today(),date9.);
run;

data bday_today;
set staff;
bday=substr(put(BIRTHDAY,date9.),1,5);
tday=upcase(substr(todays,1,5));
if bday=tday;
run;

 

proc sql;
select count(distinct MAIL_ID) into :emailcnt from bday_today;
%let emailcnt = %cmpres(&emailcnt);
select distinct MAIL_ID into :email1 - :email&emailcnt from bday_today;
quit;

%macro mail;
%if &emailcnt gt 0 %then
%do i = 1 %to &emailcnt;
filename Myemail email
from = "ravindranadh044@gmail.com"
subject = "!!! BIRTHDAY ALERT !!!"
attach=("/home/u61914035/import files/0d01cc9cebe2e8de8b60d8fbf6ee47bc.gif")
to = "&&email&i"
type = "text/html";

data null;
file Myemail;
set bday_today(where = (MAIL_ID="&&email&i"));
put 'HAPPY BIRTHDAY' ;
RUN;
%end;
%mend;
%mail;
sas_university
Obsidian | Level 7
career.clinica@gmail.com

ravindranadhchowdari@gmail.com

ravindranadh044@gmail.com

klpn.2000@gmail.com

ravalaramya1998@gmail.com

mounikarajkumar25@gmail.com

kiran.nallagulla@gmail.com

nikhilyallamandala1997@gmail.com

pathipati778@gmail.com

ravindranadh2125@gmail.com

yedumbakulapavam@gmail.com

srilakshmiramani5@gmail.com

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 15 replies
  • 1094 views
  • 0 likes
  • 3 in conversation