Introduction

SAS Micro Analytic Service 2.3 supports modules that are written in the Python programming language. A Python module represents a group of related Python functions.
Here is an example of a Python public function that can be hosted by SAS Micro Analytic Service. This example has no output. Input arguments are given in the function's argument list. This example has input variables a and b. Outputs of the function must be listed after "Output:" in the quoted string that follows the function definition. The output variables should match the variables listed in the return statement.
def calcATimesB(a, b):
  "Output: "
  print ("Function with no output variables.")
  c = a * b
  print ("Result is: ", c, ", but is not returned")
  return None
Note: Input and output argument names live in a single namespace. Therefore, they cannot be the same. This means that update arguments are not supported. This is true for all module types in SAS Micro Analytic Service, even though the Python language does not enforce such a restriction.
Last updated: March 2, 2017