01-30-2017 03:48 AM
I would like to ask for your help to determine if my idea is possible. I am currently automating a group of .sas program and currently finished writing a macro code that creates a table log or statistics that will send and email. Let's call the macro %etl_begin and %etl_end, this macro should be put on pre and post process part. I need to put this %macros in precode and post code of each .sas file without opening and pasting the macro on the code. Any idea how can I do this? Any time my .sas file increments so i'm thinking I would use a x command line to list all the .sas file on a specific folder.
01-30-2017 03:54 AM
.sas files are text files. If your code goes right at beginning and end basic line commands to append the text files should suffice. Look at the command line function called CAT.
01-30-2017 04:09 AM
Also use grep first to determine if the macro calls are already present.
01-30-2017 11:01 AM
I am not sure if this addresses your situation but if you mean that you want to execute some code before executing another SAS program file perhaps you want a control SAS program that includes the other programs. Then you could place the macro calls before/after the include. The control program would look something like:
If you have not used %include all it does is in effect read an external progam file into the current program.