I'm trying to print out a table to an email destination and then put some custom comments at the end. When I try and run the below code I get the message:
ERROR: File is in use, .
My code is:
filename mymail email content_type="text/html"
to=("[email protected]")
from=("[email protected]")
subject="My Report";
ods html3 body=mymail style=sasweb;
proc print data=sashelp.class noobs;
run;
data _null_;
file mymail ;
put "I want this to appear at the bottom of the email.";
run;
ods html3 close;
filename mymail clear;
I've tried googling for help but the search terms are so vague it's tough to narrow it down to this specific problem. Thanks for the help.
EDIT: Just to clarify - I want all the results in the body of the email. I don't want the results sent as an attachment. Also, if you comment out just the data step in the above code, the email works fine.
I wasn't able to test these two approaches in an actual email, but they did avoid the (replicable) Error: File is in use
message..
filename mymail "C:/temp/test.html";
ods html3 body=mymail style=sasweb;
proc print data=sashelp.class noobs;
footnote "Approach 1: I want this to appear at the bottom of the email.";
run;
data _null_;
file print ;
put "Approach 2: I also want this to appear at the bottom of the email.";
run;
ods html3 close;
filename mymail clear;
The change is to use the file print
reference in the data step. According to the SAS Documentation:
PRINT is a reserved fileref that directs the output that is produced by any PUT statements to the same file as the output that is produced by SAS procedures.