Analytic Store Scoring Action Set

Extracting the Saved Open Neural Network Exchange (ONNX) Model

This section contains PROC CAS code.

Note: Input data must be accessible in your CAS session, either as a CAS table or as a transient-scope table. A CAS table has a two-level name: the first level is your CAS engine libref, and the second level is the table name. You refer to this table in the CAS procedure by specifying only the second level. For more information about two-level names, see Chapter 2, Shared Concepts (SAS Viya: Machine Learning Procedures). A transient-scope table is called directly from the action and exists in memory for the duration of the action. For more information about accessing data, see SAS Viya: System Programming Guide. For more information about PROC CAS and programming in CASL, see SAS Cloud Analytic Services: CASL Programmer’s Guide and SAS Cloud Analytic Services: CASL Reference.

Although you cannot currently use PROC CAS to extract the Open Neural Network Exchange (ONNX) model that is saved to an analytic store, you can use PROC ASTORE to do this.

The following statements extract the ONNX model that is saved to an analytic store:

proc astore;
   extract rstore=mycas.mniststore
           onnx="mnist.onnx";
run;
quit;

Extracting the Saved Open Neural Network Exchange (ONNX) Model

This section contains Lua code for the analysis in the CASL version of this example, which contains details about the results.

For more information about coding in Lua, see Getting Started with SAS Viya for Lua and SAS Viya: System Programming Guide.

The following Lua code extracts the ONNX model that is saved to an analytic store:

s:loadactionset{actionset='astore'}
store = s:astore_extract{
   rstore = {name="mniststore"}
}
out = assert(io.open("mnist.onnx", "wb"))
out:write(store['blob'])
assert(out:close())

Extracting the Saved Open Neural Network Exchange (ONNX) Model

This section contains Python code for the analysis in the CASL version of this example, which contains details about the results.

For more information about coding in Python, see Getting Started with SAS Viya for Python and SAS Viya: System Programming Guide.

The following Python code extracts the ONNX model that is saved to an analytic store:

s.loadactionset('aStore')
store=s.astore.extract(rstore='mniststore')
with open('mnist.onnx','wb') as file:
   file.write(store['blob'])

Extracting the Saved Open Neural Network Exchange (ONNX) Model

This example is not available for the R programming language.

Last updated: August 04, 2026