My goal is to send the summary table on top of the mail body and send the message down with brief description. But when I try this it goes as two different mails. One with the summary table, and the other with the description. Appreciate your help.
ODS HTML FILE='/location/.HTML';
ODS HTML CLOSE;
filename mymail2 email
FROM="[email protected]"
To=("[email protected]")
CC=("[email protected]")
Subject="Marketing Communications SMS & Email Bases &YYMM"
CT= "text/html"
TYPE="text/html"
;
ods html body=mymail2 style=styles.festival;
TITLE "BASE_NAME_SUMMARY_'&YYMM.'"; FOOTNOTE;
PROC REPORT DATA=SUMMARY NOWD MISSING
STYLE(HEADER)=[FONT_SIZE=9PT BORDERSTYLE=SOLID BACKGROUND=#94b7ff FOREGROUND=BLACK BORDERWIDTH=1PX]
STYLE(COLUMN)=[FONT_SIZE=8PT BORDERSTYLE=SOLID BORDERWIDTH=1PX]
STYLE(REPORT)=[BORDERSTYLE=SOLID BORDERWIDTH=2PX];;
COLUMN BASE_NAME BASE_RECORDS;
DEFINE BASE_NAME / GROUP;
DEFINE BASE_RECORDS / ANALYSIS SUM "BASE_COUNT" STYLE(COLUMN)=[JUST=CENTER];
RBREAK AFTER / SUMMARIZE STYLE(SUMMARY)=[BACKGROUND=#94b7ff FOREGROUND=BLACK];
RUN;
ods html close;
ods noproctitle;
DATA _NULL_;
FILE mymail2;
PUT "<p>Dear All,</p>";
PUT "<p>Please find attached the validation data</p>";
PUT "<p>Regards</p>";
PUT "<p>Kevin</p>";
RUN;
CodePudding user response:
You send a mail by using the ods and another mail by executing the data step. Therefore, one solution to solve the problem is to put the final text into your proc-report step:
%let YYMM=2210;
TITLE "BASE_NAME_SUMMARY_&YYMM."; FOOTNOTE;
PROC REPORT DATA=sashelp.class NOWD MISSING
STYLE(HEADER)=[FONT_SIZE=9PT BORDERSTYLE=SOLID BACKGROUND=#94b7ff
FOREGROUND=BLACK BORDERWIDTH=1PX]
STYLE(COLUMN)=[FONT_SIZE=8PT BORDERSTYLE=SOLID BORDERWIDTH=1PX]
STYLE(REPORT)=[BORDERSTYLE=SOLID BORDERWIDTH=2PX];;
COLUMN Sex Age;
DEFINE Sex / GROUP;
DEFINE Age / ANALYSIS SUM "BASE_COUNT" STYLE(COLUMN)=[JUST=CENTER];
RBREAK AFTER / SUMMARIZE STYLE(SUMMARY)=[BACKGROUND=#94b7ff FOREGROUND=BLACK];
compute after/style=[textalign=left]; *note the styles here;
line ' ';
line @1 "Dear All";
line @1 "Please find attached the validation data";
line @1 "Regards";
line @1 "Kevin";
endcomp;
RUN;
Additional Note: If you put your macro variable YYMM into ' then it will not be resolved, but appear as '&YYMM.'.