SAS University Edition: Help Center

How do I write and run a Python 3 program using the SASPy module?

You can write and run both Python 3 programs and SAS programs with the SASPy module. You must first create a new Python 3 notebook and then enter your code.

  1. On the Notebook Dashboard, select New > Python 3. A new Jupyter notebook file with an empty code cell opens in a separate browser tab.

    New menu in Notebook Dashboard with Python 3  option selected

  2. Enter your Python program in the code cell.

  3. To run the program and add a new code cell below the program, select the cell in the notebook and click Run Cell and Select Below button on the toolbar. The output is automatically displayed below your code. You can collapse and expand the output by clicking in the left margin of the output cell.

    Note You can also run a program by using one of the Run options from the Cell menu.

    Code cell with Python 3 code