Hello SAS world,
I am using a Windows copy of SAS and the default win10 scheduler I call a simple *.bat it kicks off my SAS primary 'complicated' program, and a simple SAS log checker program both.
I have a SAS batch job that runs normally cleanly however from time to time the required resources are not available and the task fails, I trap the log and printout both from my primary program. I wanted to add a second small program that gets the log file from the first program and filters it for errors and warnings etc. into datasets, then still want to send these resulting error warning & header log data sets via email. The described creation of datasets of errors and warnings are working nicely.
What I seem to be stuck on is I cannot figure out how to then send the errors to my email? Can someone either show me a very clear example* with lots of documentation or fix this code? I can send a hello world email with a subject, it even takes macro variable and resolves it. *(a link is okay, what I have seen so far is not helping)
options emailsys=smtp emailhost=smtp.my_domain.com emailport=25;
proc options group=email;
run;
FILENAME Mailbox2 EMAIL my_email@my_domain.com'
Subject="Show Warnings SAS batch program processed, on: &my_date1., working on errors, for &my_program. program.";
DATA _NULL_;
/* my work is just the top 25 lines of the log file, the other two are results of the log file filtered with 'index' for ERROR: and WARNING respectfully */
/*my data set names: my_warning_log my_error_log My_work;*/ /* I tired proc print on a suggestion, that has not worked so far for me */
/*proc print data=My_work;*/ /*run;*/
FILE Mailbox2;
set my_error_log; /* I have read about this put _all but I am getting no where with it... */
/*[pre]*/
put _all_=; /*[/pre]*/
/*proc print data=my_warning_log;*/ /*RUN;*/
RUN;quit;
...ultimately I would like to just send all three datasets in one email but cannot figure out the first one.
but I guess that is just a stack away... TIA 😎
error:
[…]
99 FILENAME Mailbox2 EMAIL 'my_email@my_domain.com' SYMBOLGEN: Macro variable MY_DATE1 resolves to 2018-12-27_10-52-28
[…]
_ 22 ERROR 22-322: Expecting a name.
110 /*[/pre]*/ 7 The SAS System 10:52 Thursday, December 27, 2018
111 /*proc print data=my_warning_log;*/ 112 RUN;
NOTE: The SAS System stopped processing this step because of errors. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds
112 ! quit;
ERROR: Errors printed on page 6.
NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414 NOTE: The SAS System used: real time 1.57 seconds cpu time 0.84 seconds
... View more