Hi Everyone, I need one help related to SAS automated email which send email to every other individuals.
Task is : There is 6 unique segments of videos link and its description which need to be send to customers.
suppose AAA customer is receiving 1 videos link and 1 video description and others can receive 2 or more videos link with its description for every customers.
Others customers can not see others email, it has to be send to every individual or row wise.
I appreciate the help and I am able to solve the problem and now I am getting only one problem.
I can see video link and its description but for some customers whom we don't have videos, for that its resolving to "" and coming in email. I am looking to avoid this "" in email. can you please suggest how to overcome this problem
for 1st customer it have 1st segment video link and description and I am getting that information, but for rest segment it don't have video segment as expected and it has to be missing but getting "" "" "" this.
Output I am getting:
Take a look at the short video.
Collections Strategies
" " " " " " " " " "
Now trying to avoid or compress this (" " " " " " " " " ) from the email.
For example;
Link Desc: Collection Stratigies
Link: https://www.youtube.com/watch?v=6TK20Y5oD9s
need help to write sas code which can send email to this customers dynamically.
first_name |
EMAIL_ADDRESS |
Video_segment1 |
Video_segment2 |
Video_segment3 |
Video_segment4 |
Video_segment5 |
Video_segment6 |
AAA |
Yes |
|
|||||
BBB |
Yes |
yes |
|
||||
CCC |
Yes |
yes |
yes |
|
|||
DDD |
Yes |
|
|||||
EEE |
Yes |
yes |
|
||||
FFF |
Yes |
Yes |
Yes |
Yes |
Yes |
Yes |
|
GGG |
Yes |
|
|
|
|
|
Sorry for delay in response and thank you everyone for your revert.
I was able to solve the prolem by using %if and %len method.
This resolved the problem.
%if %length(Video_segment1) > 0 %then %do;
%put &Video_segment1.;
%put &Video_Desc.;
end;
Hey, @ManoharNath - First, review this excellent library article about sending email from SAS by @ChrisHemedinger: Tip: How to send email using SAS with particular emphasis on the section titled "Sending a customized message to multiple addresses". I've stolen the code from the macro used there as a starter for your solution. The rest is just simple conditional programming. Here is a pseudo-code template to get you started:
data _null_;
set customer_list;
array vids[6] video:;
array vidlink[6] $400 _temporary_
('Collection Stratigies: https://www.youtube.com/watch?v=6TK20Y5oD9s,
... LIST THE REST OF THE LINKS AND DESCRIPTIONS HERE ...);
FILE outbox
to=(EMAIL_ADDRESS )
subject="Your video links";
Salutation =cats(catx(" ","Dear",first_name),',');
put Salutation;
put;
put "Here are your video links:";
do I=1 to dim(vids);
if lowcase(vids[i])='yes' then
put vidlink[i];
end;
put;
put "All the best,";
put "Me";
run;
Hope this helps.
Mark
I appreciate the help and I am able to solve the problem and now I am getting only one problem.
I can see video link and its description but for some customers whom we don't have videos, for that its resolving to "" and coming in email. I am looking to avoid this "" in email. can you please suggest how to overcome this problem
for 1st customer it have 1st segment video link and description and I am getting that information, but for rest segment it don't have video segment as expected and it has to be missing but getting "" "" "" this.
Output I am getting:
Take a look at the short video.
Collections Strategies
" " " " " " " " " "
Now trying to avoid or compress this (" " " " " " " " " ) from the email.
Once again, I'd suggest conditional coding for that line of the email. For example:
if find(lowcase(cats(of vids[*])), 'yes') then do;
put "Here are your video links:";
do I=1 to dim(vids);
if lowcase(vids[i])='yes' then
put vidlink[i];
end;
end;
else put "You have no videos to view";
Mark
Sorry for delay in response and thank you everyone for your revert.
I was able to solve the prolem by using %if and %len method.
This resolved the problem.
%if %length(Video_segment1) > 0 %then %do;
%put &Video_segment1.;
%put &Video_Desc.;
end;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.