Suggest you run again with OPTIONS parameters that will increase the useful SAS log program compilation diagnostics, OPTIONS SOURCE SOURCE2 MACROGEN SYMBOLGEN MLOGIC; -- some of which would not necessarily apply here, without MACRO usage. Also, as was suggested, strip-out all but the bare-essential SAS processing to generate the EMAIL -- that would be the "resuting code" generated from the CALL EXECUTE -- no surrounding DATA step. And then work your way backwards, one step at a time. And, your use of FILENAME is not part of the CALL EXECUTE, in case that's what you intended. Reviewing CALL EXECUTE, that SAS code will be compiled and executed only after the current DATA step completes. Strongly suggest you start simple then increase complexity, only after suitable self-initiated desk-checking.
... View more