The OUTPUT Statement


By default, every DATA step contains an implicit OUTPUT statement at the end of the step. Placing an explicit OUTPUT statement in a DATA step overrides the automatic output, and the SAS System adds an observation to a data set only when the explicit OUTPUT statement is executed.


General form, OUTPUT statement:
OUTPUT SAS-data-set; or OUTPUT;

where SAS-data-set names the data set to which the observation is written. All data set names specified in the OUTPUT statement must also appear in the DATA statement.

Using an OUTPUT statement without a following data set name causes the current observation to be written to all data sets named in the DATA statement.


     data perm.sales97;
        infile data97;
        input ID 4. @;
        do quarter=1 to 4;
           input Sales : comma. @; 
           output; 
        end;
     run;               





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

Terms of Use & Legal Information | Privacy Statement