/****************************************/ /* Adding a file to a registered model. */ /***************************************************/ Options NOmlogic NOmprint NOspool; /***************************************************/ /* Get the SAS Model Manager macro code. */ /***************************************************/ Filename MMAccess catalog 'SASHELP.modelmgr.AccessMacros.source'; %include MMAccess; /* Fileref to the encoded password */ FILENAME pwfile 'my-network-path\pwfile'; /***************************************************/ /* Set the SAS WIP Server variables. */ /***************************************************/ %let _MM_MulticastAddress=239.27.18.213; %let _MM_MulticastPort=8561; %let _MM_User=sasdemo; data _null_; infile pwfile obs=1 length=l; input @; input @1 line $varying1024. l; call symput('_MM_Password',substr(line,1,l)); run; /***************************************************/ /* A LIBNAME for a table. */ /***************************************************/ LIBNAME mtbls 'c:\mysascode'; /***************************************************/ /* Set to detect failure in case macro load fails */ /* and add the input data source. */ /***************************************************/ %let _MM_RC= -1; %MM_AddModelFile( ModelId= //ModelManagerRepo/MMRoot/HomeEquity/HMEQ/2011/hmeqDecTree1, Name=modelinput.sas7bdat, SASDataFile=mtbls.myInputVariables, Trace=Off ); /***************************************************/ /* A FILENAME for a text file. */ /***************************************************/ FILENAME tcode 'c:\myModel\inputvar.xml'; /***************************************************/ /* Set to detect failure in case macro load fails */ /* and add the xml file for the input data source */ /***************************************************/ %let _MM_RC= -1; %MM_AddModelFile( ModelId= //ModelManagerRepo/MMRoot/HomeEquity/HMEQ/2011/hmeqDecTree1, TextFile=tcode, Trace=on);
/******************************************************/ /* Get the score code from a registered model and run */ /* it. */ /******************************************************/ Options NOmlogic NOmprint NOspool; /*****************************************************/ /* Get the SAS Model Manager macro code. */ /*****************************************************/ FILENAME MMAccess catalog 'sashelp.modelmgr.accessmacros.source'; %include MMAccess; /* Fileref to the encoded password */ FILENAME pwfile 'my-network-path\pwfile'; /*****************************************************/ /* Set the SAS WIP Server variables. */ /*****************************************************/ %let _MM_MulticastAddress=239.27.18.213; %let _MM_MulticastPort=8561; %let _MM_User = miller; data _null_; infile pwfile obs=1 length=l; input @; input @1 line $varying1024. l; call symput('_MM_Password',substr(line,1,l)); run; /*****************************************************/ /* Specify the model component file name and */ /* destination. */ /*****************************************************/ %let WorkPath = c:\myProject\2011; 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/2011/ DecisionTree, TextFile=dest); /*****************************************************/ /* Display SAS Model Manager 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\2011\DTree'; DATA score; set input.dTreeInp; %include dest; run;
/***************************************************/ /* Get the URL for the location of a model. */ /****************************************************/ Options nomlogic nomprint nospool; /****************************************************/ /* Get the SAS Model Manager macro code. */ /**************************************************** / FILENAME MMAccess catalog 'sashelp.modelmgr.accessmacros.source'; %include MMAccess; /* Fileref to the encoded password */ FILENAME pwfile 'my-network-path\pwfile'; /***************************************************/ /* Set the SAS WIP Server variables. */ /***************************************************/ %let _MM_MulticastAddress=239.27.18.213; %let _MM_MulticastPort=8561; %let _MM_User=miller; data _null_; infile pwfile obs=1 length=l; input @; input @1 line $varying1024. l; call symput('_MM_Password',substr(line,1,l)); run; /***************************************************/ /* Set to detect failure in case macro load fails */ /* and get the URL. */ /***************************************************/ %let _MM_RC= -1; %let target=aef7a78e-0a28-0e97-01c0-b8a0e5ba15c7; %MM_GetURL(UUid=&target,Trace=on); %put _MM_URL=&_MM_URL; %put _MM_ResourcesURL=&_MM_ResourcesURL;
Specify a libref.filename that
points to a LOGISTIC procedure FIT table that was created by the PROC
LOGISTIC OUTMODEL= statement, which can be used as the value to a
PROC LOGISTIC INMODEL= statement.
|
||
Specify a fileref to
a SAS data set whose variables contain the input variables that are
used by the SAS code model. An example would be a data set that was
used for training the model.
SAS Model Manager reads
one observation in the data set that is specified by the InDataSamp
argument to create the inputvar.xml file for the model. The inputvar.xml
file defines the model input variables and their metadata.
Based on the arguments
that were specified, the %MM_Register macro uses arguments to filter
variables from the data set to create the inputvar.xml file.
For more information, see KeepInVars argument.
|
||
Specify a fileref that
points to a SAS data set whose variables are NAME, TYPE, LENGTH,
LABEL, FORMAT, LEVEL, and ROLE. These variables define metadata for
the model input variables. Each row in this data set contains the
metadata for model input variables. Such a table can be created by
the CONTENTS procedure.
|
||
Specify a fileref that
points to a SAS data set whose variables contain the output variables
that are created or modified by the SAS code model. An example is
a data set that was the scored output of the model.
SAS Model Manager reads
the data set that is specified by the OutDataSamp argument to create
the outputvar.xml file for the model. The outputvar.xml file defines
the model output variables and their metadata.
Based on the arguments
that were specified, the %MM_Register macro uses arguments to filter
variables from the data set to create the outputvar.xml file.
For more information, see KeepOutVars argument.
|
||
Specify a fileref that
points to a SAS data set whose variables are NAME, TYPE, LENGTH,
LABEL, FORMAT, LEVEL, and ROLE. These variables define metadata for
the model output variables. Each row in this data set contains the
metadata for model output variables. Such a table can be created by
the CONTENTS procedure.
SAS Model Manager reads
the data set that is specified by the OutDataInfo argument to create
the outputvar.xml file for the model. The outputvar.xml file defines
the model output variables and their metadata. If you do not specify
the KeepOutVars argument, input variables and target variables are
filtered from the output table.
|
||
Specify a fileref that
points to a SAS data set whose variables contain the target variable
that is created or modified by the SAS code model. An example is a
data set that was the scored output of the model.
|
||
Specify a fileref that
points to a SAS data set whose variables are NAME, TYPE, LENGTH,
LABEL, FORMAT, LEVEL, and ROLE. These variables define metadata for
the model target variable. A row in this data set contains the metadata
for the model target variable. Such a table can be created by the
CONTENTS procedure.
|
/*****************************************************/ /* Registering a SAS Enterprise Miner Model Package. */ ******************************************************/ Options NOmlogic NOmprint NOspool; /*****************************************************/ /* Access and load the SAS Model Manager macro code.*/ /*****************************************************/ Filename MMAccess catalog 'SASHELP.modelmgr.AccessMacros.source'; %include MMAccess; /* Fileref to the encoded password */ FILENAME pwfile 'my-network-path\pwfile'; /*****************************************************/ /* Set SAS WIP Server variables. *********************/ /*****************************************************/ %let _MM_MulticastAddress=239.27.18.213; %let _MM_MulticastPort=8561; %let _MM_User = miller; data _null_; infile pwfile obs=1 length=l; input @; input @1 line $varying1024. l; call symput('_MM_Password',substr(line,1,l)); run; /*****************************************************/ /* Specify the path for a SAS Enterprise */ /* Miner Model Package file miningResult.spk. */ /*****************************************************/ FILENAME EMPak 'c:\myscorecode\EM\miningResult.spk'; /*****************************************************/ /* Set to detect failure in case macro load fails */ /* and register the Enterprise Miner model. */ /*****************************************************/ %let _MM_RC= -1; %MM_Register( VersionId= //ModelManagerModelRepos/MMRoot/HomeEquity/HMEQ/2011, EMModelPackage=EMPak, ModelName=HMEQ, Description=Home Equity Score Code, Modeler=Titus Groan, Function=Reg, Tool=SAS/Enterprise Miner, ToolVersion=v902, Subject= Loan, Trace=ON); /*****************************************************/ /* Display MM_Register defined variables. */ /*****************************************************/ Options nosource; %PUT _MM_RC = &_MM_RC; %PUT _MM_CId = &_MM_CId; Options source;
/**************************************************/ /* Registering a generic model. */ /*****************************************************/ Options nomlogic nomprint nospool; /*****************************************************/ /* Load and access the SAS Model Manager macro code. */ /*****************************************************/ Filename MMAccess catalog 'SASHELP.modelmgr.AccessMacros.source'; %include MMAccess; /* Fileref to the encoded password */ FILENAME pwfile 'my-network-path\pwfile'; /*****************************************************/ /* Set the SAS WIP Server variables. */ /*****************************************************/ %let _MM_MulticastAddress=239.27.18.213; %let _MM_MulticastPort=8561; %let _MM_User = miller; data _null_; infile pwfile obs=1 length=l; input @; input @1 line $varying1024. l; call symput('_MM_Password',substr(line,1,l)); run; /******************************************************/ /* Specify the location of the files. */ /******************************************************/ LIBNAME modelTbl 'c:\myModel\tables'; FILENAME Code 'c:\myModel\scoreCode'; /******************************************************/ /* Set to detect failure in case macro load fails */ /* and register the model in SAS Model Manager */ /******************************************************/ %let _MM_RC= -1; %MM_Register( VersionId= //ModelManagerModelRepos/MMRoot/HomeEquity/HMEQ/2011, ScoreDataStepCode=CODE, InDataSamp=modelTbl.HMEQInput, OutDataSamp=modelTbl.HMEQOutput, TargetDataSamp=modelTbl.HMEQTarget, ModelName=HMEQDTree, Description= Home Equity model Added with a SMM Macro, Trace=ON); /****************************************************/ /* Display the SAS Model Manager defined variables. */ /****************************************************/ Options nosource; %PUT _MM_RC = &_MM_RC; %PUT _MM_CId = &_MM_CId; Options source;
/*****************************************************/ /* Registering a PROC LOGISTIC OUTMODEL-style model. */ /*****************************************************/ Options nomlogic nomprint nospool; /*****************************************************/ /* Load and access the SAS Model Manager macro code. */ /*****************************************************/ Filename MMAccess catalog 'SASHELP.modelmgr.AccessMacros.source'; %include MMAccess; /* Fileref to the encoded password */ FILENAME pwfile 'my-network-path\pwfile'; /*****************************************************/ /* Set the SAS WIP Server variables. */ /*****************************************************/ %let _MM_MulticastAddress=239.27.18.213; %let _MM_MulticastPort=8561; %let _MM_User = miller; data _null_; infile pwfile obs=1 length=l; input @; input @1 line $varying1024. l; call symput('_MM_Password',substr(line,1,l)); run; /*****************************************************/ /* Specify the location of the files. */ /*****************************************************/ LIBNAME modelTbl 'c:\myModel\Tables'; LIBNAME trainTbl 'c:\HomeEquity\Tables'; FILENAME ProgCode 'c:\myModel\scoreCode'; /*****************************************************/ /* Set to detect failure in case macro load fails */ /* and register the model */ /*****************************************************/ %let _MM_RC= -1; %MM_Register( VersionId= //ModelManagerModelRepos/MMRoot/HomeEquity/HMEQ/2011, ScoreProgram=ProgCODE, LogisticOutModelTable=modelTbl.HMEQProcLogisticOutput, TrainingDataSamp=trainTbl.HMEQTraining, ModelName=HMEQLogisticOutmodel, Description=HMEQ Logistic OUTMODEL model added by macro, Trace=off); /******************************************************/ /* Display the SAS Model Manager-defined variables. */ /******************************************************/ Options nosource; %PUT _MM_RC = &_MM_RC; %PUT _MM_CId = &_MM_CId; Options source;
<?xml version="1.0" encoding="utf-8" ?> <Model> <ModelMetadata> <name>hmeq</name> <description>Home Equity Model</description> <label>HMEQ</label> <algorithm></algorithm> <function>classification</function> <modeler></modeler> <tool>SASProc</tool> <toolversion></toolversion> <subject></subject> <modelTemplate>Classification</ModelTemplate> <scoreCodeType>SAS Program</scoreCodeType> </ModelMetadata> <FileList> <File> <name>score.sas</name> <value>myScoreFile.sas</value> </File> <File> <name>modelinput.sas7bdat</name> <value>hmeqIn</value> </File> <File> <name>modeloutput.sas7bdat</name> <value>hmeqOut</value> </File> <File> <name>target.sas7bdat</name> <value>hmeqTar</value> </File> <File> <name>inputvar.xml</name> <value></value> </File> <File> <name>outputvar.xml</name> <value></value> </File> <File> <name>targetvar.xml</name> <value></value> </File> <File> <name>train.sas7bdat</name> <value></value> </File> <File> <name>Training.sas</name> <value></value> </File> <File> <name>Training.log</name> <value></value> </File> <File> <name>Training.lst</name> <value></value> </File> <File> <name>outest.sas7bdat</name> <value></value> </File> <File> <name>outmodel.sas7bdat</name> <value>om</value> </File> <File> <name>Output.spk</name> <value></value> </File> <File> <name>Format.sas7bcat</name> <value></value> </File> <File> <name>Dataprep.sas</name> <value></value> </File> <File> <name>Notes.txt</name> <value></value> </File> </FileList> </Model>
/**************************************************/ /* Register a SAS Code Model By Folder */ /*****************************************************/ Options nomlogic nomprint nospool; /*****************************************************/ /* Load and access the SAS Model Manager macro code. */ /*****************************************************/ Filename MMAccess catalog 'SASHELP.modelmgr.AccessMacros.source'; %include MMAccess; /* Fileref to the encoded password */ FILENAME pwfile 'my-network-path\pwfile'; /*****************************************************/ /* Set the SAS WIP Server variables. */ /*****************************************************/ %let _MM_MulticastAddress=239.27.18.213; %let _MM_MulticastPort=8561; %let _MM_User = miller; data _null_; infile pwfile obs=1 length=l; input @; input @1 line $varying1024. l; call symput('_MM_Password',substr(line,1,l)); run; /******************************************************/ /* Specify the location of the folder. */ /******************************************************/ %let modelFolder = c:\myModel; %let hmeq2011 = //ModelManagerModelRepos/MMRoot/HomeEquity/HMEQ/2011; /******************************************************/ /* Set to detect failure in case macro load fails */ /* and register the models in SAS Model Manager. */ /******************************************************/ %let _MM_RC= -1; %MM_RegisterByFolder(VersionId=&hmeq2011, ReportDir=&modelFolder, Trace=ON); /****************************************************/ /* Display the SAS Model Manager-defined variables. */ /****************************************************/ Options nosource; %PUT _MM_RC = &_MM_RC; Options source;
/*****************************************************/ /* Create a data set to contain model information */ /*****************************************************/ Options nomlogic nomprint nospool; /*****************************************************/ /* Load and access the SAS Model Manager macro code. */ /*****************************************************/ Filename MMAccess catalog 'SASHELP.modelmgr.AccessMacros.source'; %include MMAccess; /* Fileref to the encoded password */ FILENAME pwfile 'my-network-path\pwfile'; /*****************************************************/ /* Set the SAS WIP Server variables. */ /*****************************************************/ %let _MM_MulticastAddress=239.27.18.213; %let _MM_MulticastPort=8561; %let _MM_User = miller; data _null_; infile pwfile obs=1 length=l; input @; input @1 line $varying1024. l; call symput('_MM_Password',substr(line,1,l)); run; /******************************************************/ /* Specify the location of the data set and model */ /* path. */ /******************************************************/ libname modelDS 'c:\myModel\ModelInfo'; %let hmeq2011 = //ModelManagerModelRepos/MMRoot/HomeEquity/HMEQ/2011; /******************************************************/ /* Set to detect failure in case macro load fails */ /* and create the model data set. */ /******************************************************/ %let _MM_RC= -1; %MM_CreateModelDataset(mDatasetName=modelDS.models, smmpath=//ModelManagerDefaultRepo/MMRoot/DDHMEQ/HMEQ/2011/Models/ Regression, Trace=ON); /****************************************************/ /* Display the SAS Model Manager-defined variables. */ /****************************************************/ Options nosource; %PUT _MM_RC = &_MM_RC; Options source;