BookmarkSubscribeRSS Feed
DFHGSGSER
Calcite | Level 5

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;

1 REPLY 1
error_prone
Barite | Level 11

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).

 

 

 

 

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 988 views
  • 0 likes
  • 2 in conversation