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

 

 

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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