08-22-2017 07:23 AM
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=("email@example.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;
08-22-2017 07:24 AM
08-22-2017 08:02 AM
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 'firstname.lastname@example.org' content_type='HTML'; ods html body=out; proc print data=sashelp.class; run; ods html close;
08-22-2017 08:10 AM
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.