I have a simple program that checks a log and sends the results to the team once a program is complete. The file 'update_log' is the log of the program that has been uploaded into a SAS data set. The below code used to work with no issues, but now I am seeing ERROR: File is in use, .. I've read that this happens with the ODS statement sometimes, but I need it to be able to work with the filename statement.
%let EMAIL= 'fake@email.com' ;
filename outfile clear;
filename outfile email
subject= Data Update Summary Report &SYSDATE9."
to = (&EMAIL.)
REPLYTO = (&EMAIL.)
type = "text/html";
data _null_;
file outfile;
ODS LISTING CLOSE;
ods html body=outfile ;
ods html text='<div align="center">
<h3>System Message </h3>
<p>SEE WARNING/ERRORS BELOW</p>
</div>';
run;
run;
ods html text='<div align="center">
<body> UPDATE LOG </body>
</div>';
proc print data=UPDATE_LOG noobs label;
run;
ods html close;
ods listing;
RUN;
Using "Insert Code" or "Insert SAS Code" to post code will increase readability.
The ODS-statement is a global statment, so placing in within a data step is neither necessary nor has an useful effect. You don't need ODS-statements at all, just use put-statement in the data step to write the html-tags (not sure if this solves the problem).
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.