01-08-2015 03:03 PM
I am new to SAS. I have created a macro to email users and send attachments based on RecType. I would like to use a macro to send these emails. Is it possible to use a macro that uses a list where it references recType and email address for my current macro? So
the program sees what reccd it is, then sets the email macro variable &email. or something to whatever the corresponding email address is on that list. Then in the call execute statement the email goes to you, and “&email.” :smileygrin: A macro in a macro.
01-08-2015 05:11 PM
Yes, a DATA step could be used to read a file / list with INPUT, then construct the macro-invocation command you mention with the CALL EXECUTE. Your EMAIL-generation macro would need to take any variable information as the macro variable parameters supplied when your DATA step invokes the CALL EXECUTE.
01-08-2015 07:25 PM
Would the syntax for the email macro be something along the lines of?
%macro send_mail(RecType= , Contact=);
If RecType=&RecType then do
01-09-2015 01:23 AM
The EMAIL macro would generate the EMAIL...invoked iteratively for each EMAIL-recipient from your list (possibly a SAS file/member). The macro would contain SAS code that likely uses FILENAME and EMAIL engine to generate your EMAILs.
A DATA step would be used to drive the CALL EXECUTE processing -- you must use SAS code to build the SAS macro invocation statements as the argument passed to CALL EXECUTE.
You have to start with generating / compiling your EMAIL-recipient list, either from an external information source or possibly directly from a SAS file.
Suggest you search the Internet with argument "data step call execute invoke macro" for documentation / example references.