PYTHON Procedure
What Does the PYTHON Procedure Do?
Python is an interpreted, high-level, general-purpose programming language. The PYTHON procedure enables you to run statements from the Python programming language within SAS code. You can submit Python statements from an external Python script or enter Python statements directly.
PROC PYTHON enables you to perform these tasks:
- run Python code within a SAS session
- call most SAS functions within Python statements
- submit SAS code from Python
- move data between SAS data sets or views and Pandas DataFrames
- transfer values between SAS macro variables and Python variables
- call PROC FCMP functions within Python statements
- display Pyplot graphics
in SAS Data and AI Studio results
Note: You must install the matplotlib.pyplot module to display graphics.
You can also run Python code in batch scripts. For more information, see Introduction in Using the batch Plug-In for the SAS Viya Platform Command-Line Interface.
Last updated: September 15, 2026