Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Using the Output Delivery System

Example 15.1: Creating HTML Output with ODS

This example demonstrates how you can use the ODS HTML statement to display your output in hypertext markup language (HTML).

The following statements create the data set scores, which contains the golf scores for boys and girls in a physical education class. The TTEST procedure is then invoked to compare the scores.

The ODS HTML statement specifies the name of the file to contain the HTML output.

   data scores;
      input Gender $ Score @@;
      datalines;
   f 75  f 76  f 80  f 77  f 80  f 77  f 73
   m 82  m 80  m 85  m 85  m 78  m 87  m 82
   ;
   run;

   ods html body='ttest.htm';

   title 'Comparing Group Means';
   proc ttest ;
      class Gender;
      var Score;
   run;
   ods html close;

By default, the SAS listing receives all output generated during your SAS run. In this example, the ODS HTML statement opens the HTML destination, and both destinations receive the generated output. Output 15.1.1 displays the results as they are rendered in the SAS listing.

Note that you must specify the following statement before you can view your output in a browser.

   ods html close;

If you do not close the HTML destination, your HTML file may contain no output, or you may experience other unexpected results.

Output 15.1.2 displays the file 'ttest.htm', which is specified in the preceding ODS HTML statement.

Output 15.1.1: Results for PROC TTEST: SAS Listing Procedure Output
                                                 Comparing Group Means

                                                  The TTEST Procedure

                                                      Statistics
 
                                 Lower CL          Upper CL  Lower CL           Upper CL
    Variable  Class           N      Mean    Mean      Mean   Std Dev  Std Dev   Std Dev  Std Err  Minimum  Maximum

    Score     f               7    74.504  76.857    79.211    1.6399   2.5448    5.6039   0.9619       73       80
    Score     m               7    79.804  82.714    85.625     2.028   3.1472    6.9303   1.1895       78       87
    Score     Diff (1-2)            -9.19  -5.857    -2.524    2.0522   2.8619    4.7242   1.5298                  


                                                        T-Tests
 
                         Variable    Method           Variances      DF    t Value    Pr > |t|

                         Score       Pooled           Equal          12      -3.83      0.0024
                         Score       Satterthwaite    Unequal      11.5      -3.83      0.0026


                                                 Equality of Variances
 
                             Variable    Method      Num DF    Den DF    F Value    Pr > F

                             Score       Folded F         6         6       1.53    0.6189

Output 15.1.2: Results for PROC TTEST: HTML Procedure Output
odse0b.gif (14734 bytes)

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

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