title: SEND EMAIL BASED ON CONDITIONS (SAS)
body: <p>I found the below code (untouched) in this forum which is very close to what i was looking for however am having some issues when tweaking;</p>
  
  <pre><code>data Millenium_Falcon;
  han='1';
  luke='0';
  darth='0';
  run;
  
  filename myemail EMAIL
  to="me@lando.com"
  cc="me@lando.com"
  from="me@lando.com"
  subject="Millenium Falcon"
  importance="HIGH"
  ;
  
  data _null_;
  set Millenium_Falcon ;
  file myemail;
  IF (Luke = '1' and Darth = '0') then do;
      put "Han,";
      put " ";
      put "Look out for the asteroids.";
      put " ";
      put "Thank you.";
      put " ";
      put "Obi";
  end;
  else do;
      put '!EM_ABORT!';
  end;
  stop;
  run;
  </code></pre>
  
  <p>Before tweaking, this code works fine however when i try to point to my data set (removing Millennium_Falcon step above) which just contains meta data from dictionary.tables (libname,memname,modate) and change the if statement to </p>
  
  <pre><code>IF (memname = 'TEST' and datepart(modate) = date()) then do; 
  </code></pre>
  
  <p>the email does not send. It is almost like the data step (below) must be present (acting like datalines) for this to work.</p>
  
  <pre><code>data Millenium_Falcon;
  han='1';
  luke='0';
  darth='0';
  run;
  </code></pre>
  
  <p>Any help would be much appreciated.</p>
  
  <p>Many thanks</p>
  
  <p>Aaron</p>