RUN-Group Processing

Using Run-Group Processing

You can use RUN-group processing with the GAREABAR, GBARLINE, GCHART, GKPI, GMAP, GPLOT, GRADAR, GREPLAY, GSLIDE, and GTILE procedures to produce multiple graphs without restarting the procedure every time.
To use RUN-group processing, you start the procedure and then submit multiple RUN-groups. A RUN-group is a group of statements that contains at least one action statement and ends with a RUN statement. The procedure can contain other SAS statements such as AXIS, BY, GOPTIONS, LEGEND, TITLE, or WHERE. As long as you do not terminate the procedure, it remains active and you do not need to resubmit the PROC statement.
To end RUN-group processing and terminate the procedure, submit a QUIT or RUN CANCEL statement, or start a new procedure. If you do not submit a QUIT or RUN CANCEL statement, SAS/GRAPH does not terminate RUN-group processing until it reaches another step boundary.
Note: When using SAS/GRAPH with the ODS statement, it is best to use a QUIT statement after each procedure that uses RUN-group processing. Do this rather than relying on a new procedure to end the processing. Running too many procedures without an intervening QUIT statement can use up too much memory. Also, note that failing to submit a QUIT statement before submitting an ODS CLOSE statement results in the process memory not being freed at all.

RUN-group Processing with Global and Local Statements

Global statements and NOTE statements that are submitted in a RUN-group affect all subsequent RUN-groups until you cancel the statements or exit the procedure. For example, each of these two RUN-groups produces a plot and both plots display the title defined in the first RUN-group:
/* first run group*/
proc gplot data=sales;
   title1 "Sales Summary";
   plot sales*model_a;

      /* second run group */
   plot sales*model_b;

RUN-group Processing with BY Statements

BY statements persist in exactly the same way as global and local statements. Suppose you submit a BY statement within a RUN-group. Then the BY-group processing produces a separate graph for each value of the BY variable for the RUN-group in which you submit it. This continues for all subsequent RUN-groups until you cancel the BY statement or exit the procedure. Thus, as you submit subsequent action statements, you continue to get multiple graphs (one for each value of the BY variable). For more information, see the BY Statement.

RUN-group Processing with the WHERE Statement

The WHERE statement enables you to graph only a subset of the data in the input data set. If you submit a WHERE statement with a RUN-group, the WHERE definition remains in effect for all subsequent RUN-groups until you exit the procedure or reset the WHERE definition.
Using a WHERE statement with RUN-group processing follows most of the same rules as using the WHERE statement outside of RUN-group processing with these exceptions:
  • With the GMAP procedure, the WHERE variable must be in the input data set.
  • With a procedure that is using an Annotate data set, the following requirements must be met:
    • The ANNOTATE= option must be included in the action statement.
    • The WHERE variable must occur in both the input data set and the Annotate data set.