Chapter Contents

Previous

Next
The ODS Statements

Example 4: Using a Selection List with Multiple Procedure Steps


ODS features:
ODS SELECT statement:
with label
with name
with and without PERSIST
ALL
ODS SHOW statement
ODS HTML statement:
BODY=
CONTENTS=
FRAME=
PAGE=
Other SAS features:
PROC GLM
PROC PRINT
PROC PLOT

This example runs the same procedures multiple times to illustrate how ODS maintains and modifies a selection list. The ODS SHOW statement writes the overall selection list to the SAS log. The example does not alter selection lists for individual destinations, so the contents file that is generated by the ODS HTML statement shows which output objects are routed to both the HTML and the Listing destinations. (The Printer destination is not open.)

Note:   This example uses PROC GLM, which is part of SAS/STAT software.  [cautionend]

Note:   This example uses file names that may not be valid in all operating environments. To successfully run the example in your operating environment, you may need to change the file specifications. See Alternative ODS HTML Statements for Running Examples in Different Operating Environments.  [cautionend]


Program
 Note about code
data iron;
   input Fe Loss @@;
   datalines;
0.01 127.6   0.48 124.0   0.71 110.8   0.95 103.9
1.19 101.5   0.01 130.1   0.48 122.0   1.44  92.3
0.71 113.1   1.96  83.7   0.01 128.0   1.44  91.4
1.96  86.2
;
 Note about code
ods html body='odspersist-body.htm'
        frame='odspersist-frame.htm'
     contents='odspersist-contents.htm'
         page='odspersist-page.htm'
;
 Note about code
ods show;
 Note about code
ods select ParameterEstimates 
           "Type III Model ANOVA";
 Note about code
ods show;
 Note about code
proc glm data=iron;
   model loss=fe;
   title 'Parameter Estimates and Type III Model ANOVA';
run;
 Note about code
ods show;
 Note about code
quit;
 Note about code
ods show;
 Note about code
proc glm data=iron;
   model loss=fe;
   title 'All Output Objects Selected';
run;
quit;
 Note about code
ods select OverallANOVA(persist) "Fit Statistics";
 Note about code
proc glm data=iron;
   model loss=fe;
   title 'OverallANOVA and Fitness Statistics';
run;
 Note about code
quit;
 Note about code
ods show;
 Note about code
proc glm data=iron;
   model loss=fe;
   title 'OverallANOVA';
   title2 'Part of the Selection List Persists';
run;
 Note about code
quit;
 Note about code
proc print data=iron;
   title 'The IRON Data Set';
run;
 Note about code
ods select all;
 Note about code
proc plot data=iron;
   plot fe*loss='*' / vpos=25 ;
   label fe='Iron Content'
       loss='Weight Loss';
   title 'Plot of Iron Versus Loss';
run;
 Note about code
quit;
 Note about code
ods html close;


SAS Log

The ODS SHOW Statement Writes the Current Selection List to the SAS Log.
10   ods html body='odspersist-body.htm'
11        contents='odspersist-contents.htm'
12           frame='odspersist-frame.htm'
13            page='odspersist-page.htm';
NOTE: Writing HTML Body file: odspersist-body.htm
NOTE: Writing HTML Contents file: odspersist-contents.htm
NOTE: Writing HTML Pages file: odspersist-page.htm
NOTE: Writing HTML Frames file: odspersist-frame.htm
14   ods show;
Current OVERALL select list is: ALL   [1]
15   ods select ParameterEstimates
16              "Type III Model ANOVA";
17   ods show;
Current OVERALL select list is:    [2]
1. ParameterEstimates
2. "Type III Model ANOVA"
18   proc glm data=iron;
19      model loss=fe;
20      title 'Parameter Estimates and Type III Model ANOVA';
21   run;
22   ods show;
Current OVERALL select list is:    [3]
1. ParameterEstimates
2. "Type III Model ANOVA"
23   quit;
NOTE: PROCEDURE GLM used:
      real time           x.xx seconds
      cpu time            x.xx seconds
      
24   ods show;
Current OVERALL select list is: ALL   [4]
25   proc glm data=iron;
26      model loss=fe;
27      title 'All Output Objects Selected';
28   run;
29   quit;
NOTE: PROCEDURE GLM used:
      real time           x.xx seconds
      cpu time            x.xx seconds
      
30   ods select OverallANOVA(persist) "Fit Statistics";
31   proc glm data=iron;
32      model loss=fe;
33      title 'OverallANOVA and Fitness Statistics';
34   run;
35   quit;
NOTE: PROCEDURE GLM used:
      real time           x.xx seconds
      cpu time            x.xx seconds
      
36   
37  ods show;
Current OVERALL select list is:    [5]
1. OverallANOVA(PERSIST)
38  proc glm data=iron;
39     model loss=fe;
40     title 'OverallANOVA';
41     title2 'Part of the Selection List Persists';
42  run;
43  quit;
NOTE: PROCEDURE GLM used:
      real time           x.xx seconds
      cpu time            x.xx seconds
      
44  proc print data=iron;
45     title 'The IRON Data Set';
46  run;
NOTE: PROCEDURE PRINT used:
      real time           x.xx seconds
      cpu time            x.xx seconds
      
47  ods select all;
48  proc plot data=iron;
49     plot fe*loss='*' / vpos=25 ;
50     label fe='Iron Content'
51         loss='Weight Loss';
52     title 'Plot of Iron Versus Loss';
53  run;
54  quit;


HTML Output

Contents File Produced by the ODS HTML Statement
The contents file shows which output objects from each procedure were sent to the open ODS destinations. You can see that no output was written to the HTML destination for PROC PRINT (because it did not produce anything whose named matched the name in the selection list). You can also see that the PROC PLOT output was written to the HTML destination after the ODS SELECT ALL statement was executed. [HTML Output]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.