Running interactive procedures in SAS Studio and SAS University Edition

1

The most recent development environment for SAS programmers is SAS Studio, which is a browser-based application. The free SAS University Edition, which includes SAS/IML software, also uses SAS Studio as a development environment.

SAS Studio has a special mode for programmers who use interactive procedures such as PROC IML. (Recall that the "I" in IML stands for "interactive.") An interactive procedure in SAS enables you to submit multiple statements without exiting the procedure. For example, if you submit SAS/IML statements that define some vectors, those vectors persist and are available for the subsequent submissions until you submit the QUIT statement. (Remember: SAS/IML does not require a RUN statement to execute the submitted statements.) Other fully interactive procedures include PROC SQL and PROC OPTMODEL.

Some SAS procedures are partly interactive. Procedures such as PROC REG and PROC GLM support RUN-group processing. For these procedures, the RUN statement defines blocks of statements that get executed, but the procedure does not exit until it encounters a QUIT statement.

Setting interactive mode in SAS Studio

It is easy to put SAS Studio into interactive mode, which supports both fully and partially interactive procedures. Towards the right side of the main row of icons is an icon whose tool tip is "Go interactive." The icon is shown below:

gointeractive

When you click that icon, SAS Studio enters "interactive mode." In interactive mode, SAS Studio does not automatically submit a QUIT statement after each submission. This is very important to programmers who use interactive procedures. In the past, I have been unable to use SAS Enterprise Guide because EG does not have an interactive mode. Prior to SAS 9.4m1 when SAS Studio implemented interactive mode, I mostly used the SAS Windowing environment (display manager) to develop complex SAS programs that include calls to PROC IML. Now I have the option to use SAS Studio.

Setting interactive mode to be the default mode

You can set interactive mode to be the default mode in SAS Studio. Click on the Options icon and select Preferences from the drop-down menu. The Options icon looks like the following:

gointeractive2

When you click the Options icon, the Preferences dialog box appears. On the General tab, check the Start new programs in interactive mode field. Click Save. Future code windows will be in interactive mode by default.

gointeractive3

As a bonus, in interactive mode SAS Studio appends output to the SAS log and to the results window. Iprefer this behavior over the default behavior, which is to clear the output and log each time that you submit new statements.

As I've said before, I am excited that SAS/IML is included in the free SAS University Edition. I am also excited that the SAS Studio interface provides an easy way to enable interactive mode, so that you can enjoy using the interactive capabilities of PROC IML and other interactive procedures.

Share

About Author

Rick Wicklin

Distinguished Researcher in Computational Statistics

Rick Wicklin, PhD, is a distinguished researcher in computational statistics at SAS and is a principal developer of SAS/IML software. His areas of expertise include computational statistics, simulation, statistical graphics, and modern methods in statistical data analysis. Rick is author of the books Statistical Programming with SAS/IML Software and Simulating Data with SAS.

1 Comment

  1. Pingback: Interactive procedures in SAS - The DO Loop

Leave A Reply

Back to Top