Things to Know about Interactive Procedures


The ANOVA, ARIMA, CATMOD, FACTEX, GLM, MODEL, OPTEX, PLAN, and REG procedures are interactive procedures. They remain active after processing a RUN statement. The "proc xxx running" message in the banner of the program editor window alerts you to the fact that these procedures are still active. More statements can be submitted as a continuation of the previous statements. A new group of statements can be executed by submitting them along with a RUN statement. These procedures remain active until a DATA step or another procedure is executed, or if a QUIT statement is submitted. In many cases, interactivity is disabled when a BY statement is specified.

See the documentation of these procedures for details of their interactive capabilities.

Accessing data sets created with procedure syntax

For most of the interactive procedures, output data sets created with options (such as OUT=) in the procedure syntax are not available until after the procedure has terminated. Trying to access these data sets while the procedure is still active may result in an error message such as the following indicating that the data set is in use:

ERROR: You cannot open WORK.MYDATA.DATA for input access with record-level control because WORK.MYDATA.DATA is in use by you in resource environment REG. WORK.MYDATA cannot be opened.

This occurs because the data set has not yet been closed. Submit a QUIT; statement to terminate the interactive procedure before trying to access the data set. A note in the SAS log appears when the data set has been created and is available.

Accessing data sets created with ODS OUTPUT statements

Unlike output data sets created with procedure syntax, ODS OUTPUT statements are generally available as soon as the ODS OUTPUT statement is executed. However, when using ODS statements with interactive procedures, it is advisable to place the ODS statements within the step (that is, following the PROC statement) and to use a QUIT statement to terminate any interactive procedure you submit. For example, the intent behind the following statements is to fit a model with PROC REG, and then to fit a new model and save its parameter estimates in data set PE.

   proc reg data=mydata;
      model y = x1;
      run;

   ods output parameterestimates=pe;
   proc reg data=mydata;
      model y = x2;
      run;

However, the following warning messages are generated because an interactive procedure, REG, is running when the ODS OUTPUT statement is encountered and then REG is terminated by the second PROC REG statement.

WARNING: Output 'parameterestimates' was not created. Make sure that the output object name, label, or path is spelled correctly. Also, verify that the appropriate procedure options are used to produce the requested output object. For example, verify that the NOPRINT option is not used.

WARNING: The current ODS SELECT/EXCLUDE/OUTPUT statement was cleared because the end of a procedure step was detected. Probable causes for this include the non-termination of an interactive procedure (type quit; to end the procedure) and a run group with no output.

The messages are avoided and the data set is created by either adding the QUIT statement to terminate the first REG step before the ODS OUTPUT statement, or by moving the ODS OUTPUT statement inside the second PROC REG step. Both are done in the following statements:

proc reg data=mydata; 
        model y = x1; 
        run;
        quit;
proc reg data=mydata;
        ods output parameterestimates=pe;
        model y = x2;
        run;

Note that, unlike an output data set requested with PROC REG syntax, the data set PE is available at this point even though PROC REG is still active. A note in the log indicates its availability.