Creates an R file in the path with an example. The file structure are as follows: For official documentation go to Scoring R models documentation

create_scoreSample(path = ".", openFile = TRUE)

Arguments

path

path to create file, default current working directory

openFile

automatically open file for editing

Value

nothing

Details

  • The file should start with a function with all the input variables which SAS Viya will use to insert data

  • Then it is followed by a comment line #output: outvar1, outvar2 which is case sensitive and must follow that structure so SAS can receive the function output properly.

  • If you are using a previously created model, it should be read, we recommend .rda format, but could be a pmml file or other format that suits you, just make sure that it is properly classified as scoring resource when using inside SAS Model Manager.

  • You then can use any logic to score the model or just an arbitrary R code.

  • To pass the information back to SAS it must return a list of the variables defined at the beginning of the script.

Examples


if (FALSE) { # \dontrun{
create_scoreSample()
} # }

# SAS does not expect the following outputs necessarily
# but if you follow that structure it will play nice with other SAS Features

# EM_CLASSIFICATION - Predicted for target
# EM_EVENTPROBABILITY - Probability target=1 
# EM_PROBABILITY - Probability of Classification
# I_<<target>> - eg.: I_BAD - Into: BAD
# I_<<target>><<level>> eg.: I_BAD1 - predicted level