%MM_GetModelFile Macro

Access files in the SAS Decision Manager model repository. This macro copies the specified model file to the specified location on a local or network computer.

Syntax

%MM_GetModelFile (
ModelId=path-to-model | VersionId=path-to-version | ProjectId=path-to-project,
SASDataFile=SAS-data-set-reference | SASCatalog=SAS-catalog-reference |
TextFile=fileref-to-text-file | BinaryFile=fileref-to-binary-file
<, Name=alternateFilename>
<, Trace=ON | OFF>
);

Arguments

ModelId=path-to-model

specifies an identifier to the model in the SAS Decision Manager model repository. path-to-model can be either a SAS Decision ManagerUUID or a SAS Decision Manager path that describes the location of the specific model. ModelId is a required argument. The default value is the value of the _MM_CId macro variable.

Examples ModelId=b2341a42-0a29-0c76-011a-f7bb7bc4f1e9
ModelId=//ModelManagerDefaultRepo/MMRoot/DDHMEQ/HomeEquity/1.0/Models/HMEQ%20Loan%20Project

VersionId

specifies an identifier of the version to where a champion model resides in the SAS Decision Manager model repository. path-to-version can be either a SAS Decision Manager UUID or a SAS Decision Manager path that describes the location of the version.

Examples VersionId=b23327cb-0a29-0c76-011a-f7bb3d790340
VersionId=//ModelManagerDefaultRepo/MMRoot/DDHMEQ/HomeEquity/1.0

ProjectId

specifies an identifier of the project object. The identifier specifies the location where the champion model under the default version resides in the SAS Decision Manager model repository. path-to-project can be either a SAS Decision Manager UUID or a SAS Decision Manager path that describes the location of the project.

Examples VersionId=b232d766-0a29-0c76-011a-f7bb50921b42
VersionId=//ModelManagerDefaultRepo/MMRoot/DDHMEQ/HomeEquity

SASDataFile=SAS-data-set-reference

specifies the library reference for the location of a SAS data set. SAS-data-set-reference must be a two-level SAS name in the form libref.filename.

Example SASDataFile=mylib.modelinput

SASCatalog=SAS-catalog-reference

specifies the library reference for the location of the SAS catalog to store a SAS catalog file. SAS-catalog-reference must be a two-level SAS name in the form libref.catalog.

Example SASCatalog=mylib.format

TextFile=fileref-to-text-file

specifies the file reference for the location of a component file that is an ASCII text file. fileref-to-text-file is a one-level SAS reference to a model component file.

Example TextFile=myfileref

BinaryFile=fileref-to-binary-file

specifies the file reference for the location of a model component file that is a binary file. fileref-to-binary-file is a one-level SAS reference to a model component file that is not a text file.

Example BinaryFile=myfileref

Name=alternateFileName

specifies a name for the model component file that you are retrieving. Use the Name argument when the name of the destination file does not match the name of the file in theSAS Decision Manager model repository. The Name argument is the filename within the SAS Decision Manager model repository. If Name is not specified, the filename that is registered in the SAS Decision Manager model repository is the name of the file.

Example Name=score.sas

Trace=ON | OFF

specifies whether to supply verbose trace messages to the SAS log.

Default OFF
Example Trace=on

Details

Use the %MM_GetModelFile macro to retrieve a component file for a model that has been registered in the SAS Decision Manager model repository. You can retrieve a component file for any model by specifying the repository location of the model, or you can retrieve a component file for a champion model by specifying the version or project location in the SAS Decision Manager model repository.
The %MM_GetModelFile macro supports two types of files, text and binary files. Text files are ASCII files that contain character data. Binary files are files that are created by an application in a format that is specific to that application. If you are retrieving a text file, you must use the TextFile argument to specify the file. To avoid any unintentional character translations, all non-text files should be retrieved by using the BinaryFile argument.
SAS data files and SAS catalogs are binary files. Instead of using the BinaryFile argument to retrieve model component files to store as a SAS file or in a SAS catalog, you can use the SASDataFile and SASCatalog arguments respectively to specify the SAS location to store the file. The TextFile and BinaryFile arguments require a single SAS filename.
You can use the optional Name argument if you want to save the model component file with a different name from the name within the SAS Decision Manager model repository.
After you use the %MM_GetModelFile macro to copy a model component file to its new location, you can use the model component file for any purpose. For example, a simple application might use the %MM_GetModelFile macro to copy a registered model's score code file to the SAS WORK library. After the score code is copied to WORK, you can write SAS code that includes the score code in a SAS DATA step and is executed for experimental purposes.
If the destination file argument or the two-level SAS library reference name that is invoked in the macro uses the original filename, you do not need to specify the Name argument. In other words, the macro can use the SAS logical names to determine the name of the file in the model hierarchy. If the name of the destination file needs to be different from the name of the original file that was copied, use the Name argument to specify the new name for the model component file.

Example

/******************************************************/
/* Get the score code from a registered model and run */
/* it.                                                */
/******************************************************/

 Options NOmlogic NOmprint NOspool; 

/*****************************************************/
/* Get the Model Management macro code.             */
/*****************************************************/

 FILENAME MMAccess catalog 'sashelp.modelmgr.accessmacros.source';
 %include MMAccess; 

/*****************************************************/
/* Specify the model component file name and         */
/* destination.                                      */
/*****************************************************/

%let WorkPath = c:\myProject\1.0;
 FILENAME dest '&WorkPath.\score.sas';

/*****************************************************/
/* Set to detect failure in case macro load fails.   */
/*****************************************************/

%let _MM_RC = -1;

/*****************************************************/
/* Get score code.                                   */
/*****************************************************/

%MM_GetModelFile(ModelId=//ModelManagerRepo/MMRoot/HomeEquity/HMEQ/1.0/
DecisionTree, TextFile=dest);

/*****************************************************/
/* Display Model Management set macro variables.    */
/*****************************************************/

Options nosource;
%PUT _MM_RC = &_MM_RC;
%PUT _MM_CId = &_MM_CId;
Options source;

/*****************************************************/
/* Run score code. Sepcify the LIBNAME input path.   */
/*****************************************************/

LIBNAME input 'c:\mysascode\1.0\DTree'; 
DATA score;
 set input.dTreeInp; 
 %include dest;
run;
Last updated: February 22, 2017