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

Example 6.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 AR2, which contains a second-order autocorrelated time series Y. The AUTOREG procedure is then invoked to estimate the time trend of Y.

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


   data AR2;
      ul = 0; ull = 0;
      do Time = -10 to 36;
         u = + 1.3 * ul - .5 * ull + 2*rannor(12346);
         Y = 10 + .5 * time + u;
         if Time > 0 then output;
         ull = ul; ul = u;
      end;
   run;

   ods html body='trend.htm';

   title 'Estimated Time Trend of Y';
   proc autoreg;
      model Y = Time;
   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 6.1.1 displays the results as they are displayed 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 6.1.2 displays the file 'trend.htm', which is specified in the preceding ODS HTML statement.

Output 6.1.1: Results for PROC AUTOREG: SAS Listing Output
                           Estimated Time Trend of Y

                             The AUTOREG Procedure

                            Dependent Variable    Y


                        Ordinary Least Squares Estimates

         SSE                 214.953429    DFE                       34
         MSE                    6.32216    Root MSE             2.51439
         SBC                 173.659101    AIC               170.492063
         Regress R-Square        0.8200    Total R-Square        0.8200
         Durbin-Watson           0.4752                                


                                          Standard                 Approx
      Variable        DF     Estimate        Error    t Value    Pr > |t|

      Intercept        1       8.2308       0.8559       9.62      <.0001
      Time             1       0.5021       0.0403      12.45      <.0001

Output 6.1.2: Results for PROC AUTOREG: HTML Output
odsex01b.gif (64441 bytes)

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

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