Hello,
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:
http://www.lexjansen.com/pharmasug/2002/proceed/TechTech/tt14.pdf
Could someone post the code transforming MPRINT Outputs to executable code?
While someone took the time to write a paper and a macro about this, you really only need a small change.
options mprint;
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.
How would i write code that is out of Macros ?
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.
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 ?
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.
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.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.