BookmarkSubscribeRSS Feed

How to create a user-defined report in SAS Model Manager

Started ‎12-21-2015 by
Modified ‎01-06-2016 by
Views 2,076

Users often want to create user-defined reports specific to their organization and governance requirements. You can define such a report within SAS Model Manager so that the reports appear to be 'out of the box'. To accomplish this you need to create the code, add some SAS Model Manager-specific statements and subsequently locate the code where SAS Model Manager can access it. 





  • REPORT CODE   a  SAS program that creates the report
  • MACRO CODE    a  SAS program that lists any SAS Model Manager global macros used in the report
  • XML FILE            a  Report template file that specifies report requirements, (i.e., name, # of models)

Once these files have been uploaded to the content server, the report will appear as one of options in the ‘Reports’ drop down selection box.





  1.   WRITE AND TEST THE CODE that creates your report


        Add Model Manager wrapper code   this code allows the user to select format/style


        Filename mmreport catalog "sashelp.modelmgr.reportexportmacros.source";

        %include mmreport;



            … your-user—defined-report-code





     This is a required file.  If your report doesn’t use any global macros, create a SAS program with a comment in it.


               Sample program to define macros:

                                %let _MM_User = longj5;

                                %let _MM_Password = AristotleAndSocrates;



SAS Model Manager provides a sample report template that you can use as a model for your XML template.  A best practice is to open the model XML template and save the template using another name. To open a sample report template, follow these steps:


Select Tools .......  Manage Templates to open the SAS Model Manager Template Editor.

Select File .....  Browse .....  Browse Templates. Select UserReportTemplate.xml and click OK.

Select File .....  Save As...... Enter a name in the File name field and click OK.


The UserReportTemplate.xml file has arguments in quotation marks that you modify for your report. Replace the text in quotation marks with values that are appropriate for your report. See the argument descriptions below.

  • Add the SAS ‘Report Code’ program name to the filename argument for <Code>

            for example        < Code filename = “” >


  • Add the SAS ‘Macro Code’ program name to the filename argument for <PreCode>

            for example       < PreCode filename = “” >


Here is the report template XML definition edited to reflect your report





     After you have the two SAS programs for your user report, follow these steps to upload them to the SAS Content Server:


      Select Tools ..... Manage Templates to open the SAS Model Manager Template Editor.





       Select File ..... Open, select the program in the Open window, and click OK.




        Select File .....  Upload File to upload the program to the SAS Content Server.




       Repeat steps 2 and 3 to upload the second and third file.  NOTE:  upload the macro file LAST !







        At the Version level  Right Mouse Click on New Report




        The report is named using the value contained in the 'displayName= ' paramter of the XML




         Choose the model for use in the report and change the output file name and description to something useful.






Version history
Last update:
‎01-06-2016 01:42 PM
Updated by:

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags