Previous Page | Next Page

Using the Output Delivery System

Example 20.2 Selecting ODS Tables for Display

You can use the ODS SELECT statement to deliver only a subset of the tables or graphs to ODS destinations. The following statements create an input SAS data set and use PROC GLM to perform an analysis of an unbalanced two-way experimental design:

title 'Unbalanced Two-way Design';
data twoway;
   input Treatment Block y @@;
   datalines;
1 1 17   1 1 28   1 1 19   1 1 21   1 1 19   1 2 43   
1 2 30   1 2 39   1 2 44   1 2 44   1 3 16
2 1 21   2 1 21   2 1 24   2 1 25   2 2 39   2 2 45   
2 2 42   2 2 47   2 3 19   2 3 22   2 3 16
3 1 22   3 1 30   3 1 33   3 1 31   3 2 46   3 3 26   
3 3 31   3 3 26   3 3 33   3 3 29   3 3 25
;

proc glm data=twoway;
   class Treatment Block;
   model y = Treatment | Block;
   means Treatment;
   lsmeans Treatment;
   ods select ModelANOVA Means;
   ods trace on;
   ods show;
run;

The ODS SELECT statement specifies that only the two tables ModelANOVA and Means are to be delivered to the ODS destinations. In this example, no ODS destinations are explicitly opened. Therefore, only the default LISTING destination receives the procedure output. The ODS SHOW statement displays the current overall selection list in the SAS log. The ODS SHOW statement is not required; it is used here simply to show the effects of the ODS SELECT statement. The results of the ODS SHOW statement are as follows:

   Current OVERALL select list is:
   1. ModelANOVA
   2. Means

The ODS TRACE statement writes the trace record of the ODS output objects to the SAS log. The trace record is as follows:

   Output Added:
   -------------
   Name:       ModelANOVA
   Label:      Type I Model ANOVA
   Template:   stat.GLM.Tests
   Path:       GLM.ANOVA.y.ModelANOVA
   -------------

   Output Added:
   -------------
   Name:       ModelANOVA
   Label:      Type III Model ANOVA
   Template:   stat.GLM.Tests
   Path:       GLM.ANOVA.y.ModelANOVA
   -------------

   Output Added:
   -------------
   Name:       Means
   Label:      Means
   Template:   stat.GLM.Means
   Path:       GLM.Means.Treatment.Means
   -------------


Note that there are two tables with the name ModelANOVA. One contains the "Type I Model ANOVA" table, and the other contains the "Type III Model ANOVA" table. If you wanted to select only one of them, you could specify either of the labels in the ODS SELECT statement instead of the name. You would specify one of the following:

   ods select 'Type I Model ANOVA' Means;
   ods select 'Type III Model ANOVA' Means;

In the following statements, the ODS SHOW statement writes the current overall selection list to the SAS log, the QUIT statement ends the PROC GLM step, and the second ODS SHOW statement writes the selection list to the log after PROC GLM terminates:

ods show;
quit;
ods show;

The results of these statements are as follows:

ods show;
   Current OVERALL select list is:
   1. ModelANOVA
   2. Means
quit;
ods show;
   Current OVERALL select list is: ALL

PROC GLM supports interactive RUN-group processing. Before the QUIT statement is executed, PROC GLM is active and the ODS selection list remains at its previous setting. The list includes only the two tables, ModelANOVA and Means. After the QUIT statement, when PROC GLM is no longer active, the selection list is reset to ALL. The displayed output, shown in Output 20.2.1, consists of the three selected tables (two ModelANOVA tables and the Means table). Note that the LS-means results are not displayed even though an LSMEANS statement was specified. This is because the LS-means table, named LSMeans, is not specified in the ODS SELECT statement. Other tables are suppressed as well.

Output 20.2.1 The Selected Tables from PROC GLM
Unbalanced Two-way Design

The GLM Procedure
 
Dependent Variable: y

Source DF Type I SS Mean Square F Value Pr > F
Treatment 2 8.060606 4.030303 0.24 0.7888
Block 2 2621.864124 1310.932062 77.95 <.0001
Treatment*Block 4 32.684361 8.171090 0.49 0.7460

Source DF Type III SS Mean Square F Value Pr > F
Treatment 2 266.130682 133.065341 7.91 0.0023
Block 2 1883.729465 941.864732 56.00 <.0001
Treatment*Block 4 32.684361 8.171090 0.49 0.7460

Unbalanced Two-way Design

The GLM Procedure

Level of
Treatment
N y
Mean Std Dev
1 11 29.0909091 11.5104695
2 11 29.1818182 11.5569735
3 11 30.1818182 6.3058414

For more information about ODS exclusion and selection lists, see the section The ODS Statement.


Previous Page | Next Page | Top of Page