Is it possible to loop through the records of a table to populate an html email without repeating the beginning and the end of the email?
With this example I get a mail with 5 tables of 1 row (because WORK.MyEmailTable
is table of 5 records and set
creates a loop in the data step):
data _null_;
file mymail;
set WORK.MyEmailTable;
put '<html><body><table>';
***loop through all records;
put '<tr>';
put %sysfunc(cats('<td>',var1,'</td>'));
put %sysfunc(cats('<td>',var2,'</td>'));
put %sysfunc(cats('<td>',var3,'</td>'));
put '</tr>';
put '</table></body></html>';
run;
And I'm looking to have 1 table of 5 rows.
I don't know if there is a way to prevent recursively put
the beginning and the end of the mail when you use set
in the data step.
(Let me know if it's not clear I'll update.)
Thank you,