<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Advanced coding to automails in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Advanced-coding-to-automails/m-p/733266#M28552</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I have an Excel file, which I get from external people, can I make an automail (sending out the file without any manual work) that has rules based on the content of that excel file?&lt;/P&gt;
&lt;P&gt;The file that Has to be send out - has a column that says whether test places of COVID has shut down - if so the field will be red:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%" height="30px"&gt;Place&lt;/TD&gt;
&lt;TD width="50%" height="30px"&gt;status&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%" height="30px"&gt;place A&lt;/TD&gt;
&lt;TD width="50%" height="30px"&gt;&lt;FONT color="#FF0000"&gt;CLOSED&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%" height="30px"&gt;Place B&lt;/TD&gt;
&lt;TD width="50%" height="30px"&gt;&lt;FONT color="#FF0000"&gt;CLOSED&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%" height="30px"&gt;Place C&lt;/TD&gt;
&lt;TD width="50%" height="30px"&gt;OPEN&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The automail should then send out in a text out saying: place A and PLACE B are closed&lt;/P&gt;
&lt;P&gt;I know how to do the script automatic - but how can I code so i dont manually have to change the email text based on the content of the file - is should do it by it self&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it possible ?&lt;/P&gt;</description>
    <pubDate>Tue, 13 Apr 2021 11:09:40 GMT</pubDate>
    <dc:creator>mmea</dc:creator>
    <dc:date>2021-04-13T11:09:40Z</dc:date>
    <item>
      <title>Advanced coding to automails</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Advanced-coding-to-automails/m-p/733266#M28552</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I have an Excel file, which I get from external people, can I make an automail (sending out the file without any manual work) that has rules based on the content of that excel file?&lt;/P&gt;
&lt;P&gt;The file that Has to be send out - has a column that says whether test places of COVID has shut down - if so the field will be red:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%" height="30px"&gt;Place&lt;/TD&gt;
&lt;TD width="50%" height="30px"&gt;status&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%" height="30px"&gt;place A&lt;/TD&gt;
&lt;TD width="50%" height="30px"&gt;&lt;FONT color="#FF0000"&gt;CLOSED&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%" height="30px"&gt;Place B&lt;/TD&gt;
&lt;TD width="50%" height="30px"&gt;&lt;FONT color="#FF0000"&gt;CLOSED&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%" height="30px"&gt;Place C&lt;/TD&gt;
&lt;TD width="50%" height="30px"&gt;OPEN&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The automail should then send out in a text out saying: place A and PLACE B are closed&lt;/P&gt;
&lt;P&gt;I know how to do the script automatic - but how can I code so i dont manually have to change the email text based on the content of the file - is should do it by it self&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it possible ?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 11:09:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Advanced-coding-to-automails/m-p/733266#M28552</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2021-04-13T11:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: Advanced coding to automails</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Advanced-coding-to-automails/m-p/733306#M28561</link>
      <description>&lt;P&gt;OK - some assumptions:&lt;/P&gt;
&lt;P&gt;1. You have SAS/Access to PC File Formats, so we can access the Excel file&lt;/P&gt;
&lt;P&gt;2. For this example, the Excel file is c:\temp\COVIDPlaces.xlsx and it contains one tab named Places with your sample data on it.&lt;/P&gt;
&lt;P&gt;3. You know the information needed to set up SMTP email from SAS.&lt;/P&gt;
&lt;P&gt;If so, here's some code to get you started:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* These options tell SAS how to send email for you */
options EMAILSYS=SMTP  
        EMAILHOST=("mailhost.example.com" PORT=25 
        USERID="sas.jedi@example.com" PW="This is my password";
/* Access the Excel file */
libname xl XLSX "C:\temp\COVIDClinics.xlsx";

/* Here we set up the recipient email address, subject line &amp;amp; format for the email:*/
filename mymail email "sas.jedi@example.com" 
         subject="Closed Places" 
         lrecl=256 type="TEXT/HTML";

/* Make the email look pretty */
options nocenter ls=124;
ods html5 body=mymail style=journal;
title;

/* Send the email */
data _null_;
   file print;
   set xl.places end=last;
   where upcase(status)='CLOSED';
   if _n_=1 then do;
      put "To whom it may concern:";
      put "Here is a list of the closed places:";
   end;
   put Place; 
   if last then do;
      put / "May the SAS be with you!";
      put "Mark";
   end;
run;

ods html5 close;
filename mymail clear;
libname xl clear;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 13:19:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Advanced-coding-to-automails/m-p/733306#M28561</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2021-04-13T13:19:19Z</dc:date>
    </item>
  </channel>
</rss>

