Hello,
I have the below code which looks at exporting the datasets. However, I'd like the email to have the HTML results attached as a PDF instead - any ideas?
%let user = crf;
%let dataset=CIRC;
%let dataset1=/user/&user/CIRC.csv;
Data &dataset;
set CIRC;
run;
proc export data=&dataset
outfile="&dataset1"
dbms=csv
replace;
run;
***update email recipients here***;
filename mymail email
To=("cameron.test@test.com" )
subject="Circulation Report - Prev 90 days"
attach=("&dataset1");
data _null_;
file mymail;
put "Hello,";
put " ";
put "Please see the attached circulation file for campaigns sent in the last 90 days.";
put " ";
put "This report can be used as a retrospective sense check. ";
put " ";
put"Thanks,";
put"CWR automated message";
run;
I see nothing in your code that creates HTML output?
Sorry, I posted just the email aspect of the code.
I create results (sas report) which is what I want attaching in the email.
Thanks
To attach a file to an email, use the attach= option in the filename email statement.
To directly embed HTML output, use the content_type option:
filename out email 'receive@domain.com' content_type='HTML';
ods html body=out;
proc print data=sashelp.class;
run;
ods html close;
Do be aware that email is a really poor medium for distributing data. You could hit size or other restrictions, you also have multiple copies out there, no control, email is not secure etc. Use a web portal, with access controls.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.