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.
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.
CREATING THE INPUT FILES
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";
… your-user—defined-report-code …
2. CREATE MACRO CODE FILE
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;
3. EDIT THE .XML TEMPLATE FILE
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.
for example < Code filename = “createforecastgraph.sas” >
for example < PreCode filename = “SASMM_Macros.sas” >
Here is the report template XML definition edited to reflect your report
4. UPLOAD THE FILES TO THE CONTENT SERVER
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 !
EXECUTING A USER DEFINED REPORT
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.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.