Extracting the Champion Model from a Channel

Using the %MM_GetModels() Macro

Before you run the %MM_RunReports() macro, you must extract the model from the publishing channel to a local computer. The model must have been published to the channel from the project folder. The %MM_GetModels() macro extracts models and auxiliary files from a SAS Publishing Framework SPK file to the local computer. All models that were published to the specified channel are included in the SPK file for a given SAS Model Manager project. If a model has been published multiple times over the channel, the latest model is used in the extraction. The macro then extracts the files from the SPK file to their respective folders on the local computer. The auxiliary files are extracted to the model folder and the model score code is extracted to a folder named \scorecode, which the macro creates as a subfolder of the model folder.
Note: You can run the %MM_GetModels() macro when no new model has been published to the channel for a SAS Model Manager project.
The auxiliary files include three SAS data sets:
  • current.sas7bdat contains project and model metadata
  • logs.sas7bdat contains the SAS logs that were created during the model extraction process
  • processingspk.sas7bdat contains information that is necessary to process the SPK file
The models in the \scorecode folder are named using the project UUID as the model folder name. The %MM_RunReports() macro uses the mm_jobs.project data set to determine the project UUID. The project UUID is then used as the name of the model on the local computer for scoring when the performance monitoring reports are created.
The current data set contains project and model information and is used by the %MM_RunReports() macro. To ensure that the %MM_RunReports() macro is using the most current project and model metadata, always run the %MM_GetModels() macro before you run the %MM_RunReports() macro. For a list of the information that is contained in the current data set, see The current.sas7bdat Data Set.

Accessing SAS Model Manager Report Macros

The %MM_RunReports() macro, the %MM_GetModel() macro, and all other SAS Model Manager macros are available in the catalog sashelp.modelmgr.reportmacros.source. Use the following FILENAME statement to make these macros available to your program:
filename repmacro catalog 'sashelp.modelmgr.reportmacros.source';
%inc repmacro;

%MM_GetModels() Macro Syntax

Here is the syntax for the %MM_GetMacros() macro:
%MM_GetModels(channel=channelPathlocalPath=localModelPath);
channel=channelPath
specifies the path of the channel to extract the models from. To obtain the channel path, see Determine the Publish Channel. Do not enclose the value of channel in quotation marks.
Note: The %MM_GetModels() macro supports only publishing channels that have a persistent store type of Archive.
localPath=localModelPath
specifies a folder on the local computer to where the model and auxiliary files are extracted from the SPK file. Do not enclose localModelPath in quotation marks.

Example Program to Extract a Model from a Channel

The following SAS code uses the %MM_GetModel macro to extract a champion model from a channel.
/* Source file name: sashelp.modelmgr.reportExample1.source */

FILENAME mmmac 
  catalog 'sashelp.modelmgr.reportmacros.source';
%inc mmmac;

%MM_GetModels(
  channel=\\network1\MMChampion\channel1,
  localPath=c:\mm.test\model.extraction);

The current.sas7bdat Data Set

When models are extracted from a publishing channel, the current.sas7bdat data set contains the following information for each model:
Variable Name for the Project or Model Information
Description
algorithm
The algorithm that was used to create the model
fileName
Not used
isChampionModel
True or False to indicate whether the model is the champion model
keyWords
Keywords
miningFunction
The type of mining function, such as classification, prediction, segmentation
model
Not used
modeler
The name of the person who created the model
modelName
The name of the model
modelProductionTimestamp
The time that the model was declared as a production model
modelTool
The name of the tool that was used to train the model
modelUUID
The UUID for the model
nodeDescription
Not used
projectPath
The project URL
project UUID
The UUID for the project
repository
The repository URL
scoreCodeType
DATA Step or SAS Program
subject
The subject name
targetName
The Training Target Variable name
userAttr
User-defined attributes, such as "MODELER='sasguest' MODELPROJECTVARMAP='predictedProbability eq P_BAD1; predictedClass eq I_BAD;' "
versionName
The name of the version that contains the model
whenPublished
The date and time when the project or model was published to the channel
whoPublished
The SAS Model Manager user who published the model