Setting Metadata Connection System Options

Before running macros in a SAS program that requires a connection to the SAS Metadata Server, specify the metadata connection system options. If these options are not specified, you will be prompted for the information. If you are running the macros in batch mode, you must specify the metadata server connection system options. Otherwise, you will receive a failure message.
Here is a sample OPTIONS statement that specifies these options:
options metaPort=8561 
        metaServer=server-address 
        metaRepository=Foundation
        metaUser=user-ID 
        metaPass=password;
For more information, see Connection Options in SAS Language Interfaces to Metadata.
Example 1: Specifying the metadata server connection system options when registering models to the SAS Metadata Repository using the %AAMODEL and %AA_MODEL_REGISTER macros.
options mlogic mprint symbolgen;

/* Set up the metadata connection system options. */

options metaPort=8561 
      metaServer=a123.us.company.com
      metaRepository=Foundation
      metaUser=myuserID
      metaPass=sasuser1;

libname mmlib "!sasroot\mmcommon\sample";

proc logistic data=mmlib.hmeq_train;
class bad job reason;
model bad = CLAGE CLNO DEBTINC DELINQ DEROG JOB NINQ REASON VALUE YOJ;
store work.itemstore;
run;QUIT;

%aamodel;
%aa_model_register(
ModelName=model_1,
itemstore=work.itemstore, 
spk=Y, 
register=Y, 
spkfolder=c:\temp,
mrPath=%NRBQUOTE(/Shared Data/Model Manager/Publish/Models)
);
Example 2: Using the metadata connection system options when accessing files in the SAS Model Manager model repository. This macro copies the specified model file to the specified location on a local or network computer.
/******************************************************/
/* Get the score code from a registered model and run */
/* it.                                                */
/******************************************************/

 Options NOmlogic NOmprint NOspool; 

/*************************************************/ 
/*Set up the metadata connection system options. */
/*************************************************/

options metaPort=8561 
      metaServer=a123.us.company.com
      metaRepository=Foundation
      metaUser=myuserID
      metaPass=sasuser1;

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

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

/*****************************************************/
/* Specify the model component filename and         */
/* destination.                                      */
/*****************************************************/

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

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

%let _MM_RC = -1;

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

%MM_GetModelFile(name=score.sas,
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. Specify the LIBNAME input path.   */
/*****************************************************/

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