Chapter Contents

Previous

Next
The Complete Guide to the SAS Output Delivery System

Creating an Output Data Set

The Output Delivery System enables you to create a data set from an output object. To create a data set, use the ODS OUTPUT statement. In this statement, you identify

To create a single output data set, use this simplified form of the ODS OUTPUT statement:

ODS OUTPUT output-object=SAS-data-set;

Specify the output object as you do in the ODS SELECT statement: with a path, a name, a label, or a partial path. For example, to generate and print an output data set from each output object that contains the basic measures that PROC UNIVARIATE produces, use the following SAS program.

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]

/* Turn off the generation of Listing output   */
/* because you want to create a data set, not  */
/* see the results.                            */
ods listing close;

/* Specify the data set to create. */
ods output BasicMeasures=measures;

/* When PROC UNIVARIATE runs, ODS    */
/* creates a data set named MEASURES */
/* from the output object named      */
/* BasicMeasures.                    */
proc univariate data=statepop mu0=3.5;
   var citypop_90 noncitypop_90;
   title;
run;
/* Open the HTML destination for PROC PRINT. */
ods html body='measures-body.htm'
     contents='measures-contents.htm'
        frame='measures-frame.htm';
/* Print the output data set. */
proc print data=measures noobs headings=horizontal;
   title 'Output Data Set Produced from';
   title2 'PROC UNIVARIATE Basic Measures';
run;

/* Reset the destinations to their defaults. */
/* Close the HTML destination.               */
ods html close;
/* Open the Listing destination.             */
ods listing;

You can use the resulting data set as input to another SAS program. This program simply prints the data set to illustrate its structure. The HTML output from PROC PRINT follows:

PROC PRINT Report of the Data Set Created by PROC UNIVARIATE and ODS
The data set contains observations for each of the variables in the VAR statement in PROC UNIVARIATE. [HTML Output]

For more information on creating output data sets, see ODS OUTPUT Statement.


Chapter Contents

Previous

Next

Top of Page

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