Resources

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. If you do not have a Launcher tab open in the main work area, click New Launcher button on the File Browser tab. From the Launcher tab, click the Python 3 kernel in the Notebook area. A new Jupyter notebook file with an empty code cell opens in a separate tab.

    Launcher tab with Python 3 kernel 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 the selected cells and advance button on the toolbar. The output is automatically displayed below your code. You can collapse and expand the output by positioning your mouse pointer in the left margin of the output cell and clicking the blue bar.

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

    Code cell with Python 3 code