mercredi 6 septembre 2017

SEND EMAIL BASED ON CONDITIONS (SAS)

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;

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;

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

IF (memname = 'TEST' and datepart(modate) = date()) then do; 

the email does not send. It is almost like the data step (below) must be present (acting like datalines) for this to work.

data Millenium_Falcon;
han='1';
luke='0';
darth='0';
run;

Any help would be much appreciated.

Many thanks

Aaron

Aucun commentaire:

Enregistrer un commentaire