07-10-2017 11:29 AM
I have a large project with lots of macros and included programs (SAS 9.3 on WIN server via EG 7.1 32-bit). The idea is to produce executable code in external .sas files after the project execution.
I have found this article and would like to do exactly they are doing:
Could someone post the code transforming MPRINT Outputs to executable code?
07-10-2017 11:58 AM
While someone took the time to write a paper and a macro about this, you really only need a small change.
filename mprint 'path to some file to hold the SAS code';
Run your macro-based code, and take a look at the file that you define in the FILENAME statement. You'll see all the SAS code is there. Although it is not pretty, it's the code you are asking for.
07-11-2017 07:09 AM
You don't. You just run the code that includes and utilizes the macros. At the end of that, any code that was generated by the macros will magically appear in the file that you have defined in the FILENAME statement.
Note that this does NOT include code that is not macro-generated. So if there is a mix of macro and non-macro code, you will still need to integrate the macro-generated code with the non-macro-generated code.
07-11-2017 08:23 AM
My question actually is about how to intagrate this all and not about the magic of MPRINT option, not to say more. Specificaly when thete is 50000 lines of code and lots of marco variables out of macros ?
07-11-2017 08:45 AM
I think your question would be clearer if you could give an example. You don't need to show 500,000 lines of code. But make an example of the the sort of code you have as a starting points, and then show what your would like to get as output from post-processing the code.
07-11-2017 11:44 AM
There's no easy road to integrating here. You have three sources of code:
(1) SAS code that is part of the program
(2) SAS code that is in a file, brought in by %include
(3) SAS code that is generated by running macros
MFILE / MPRINT provides the third source, the SAS code that was generated by running macros. But you still have to roll up your sleeves and combine all three sources in the right order. Presumably, this client is paying you for your time to do this.