Previous Page | Next Page

SAS Output

Traditional SAS Listing Output

Example of Traditional Listing Output

Many SAS procedures process or analyze data and can produce output as one result. You can also generate a listing by the DATA step, using a combination of the FILE and PUT statements.

See the procedure descriptions in Base SAS Procedures Guide for examples of output from SAS procedures. For a discussion and examples of DATA step output, see the FILE and PUT statements in SAS Language Reference: Dictionary.

This example produces a listing that is generated by the PUT and FILE statements in a DATA step. The input file is the SAS data set GRAIN_PRODUCERS.

options pagesize=60 linesize=64 nodate pageno=1;

title 'Leading Grain Producers';
title2 'for 1996';

data _null_;
   set grain_producers;
   file print header=newpage;
   if year=1996;
   format country $cntry.;
   label type='Grain';
   put country @25 type @50 kilotons;
      put 'Country' @25 'Grain' @50 'Kilotons';
      put 60*'=';

                    Leading Grain Producers                    1
                            for 1996
Country                 Grain                    Kilotons
Brazil                  Wheat                    3302
Brazil                  Rice                     10035
Brazil                  Corn                     31975
China                   Wheat                    109000
China                   Rice                     190100
China                   Corn                     119350
India                   Wheat                    62620
India                   Rice                     120012
India                   Corn                     8660
Indonesia               Wheat                    .
Indonesia               Rice                     51165
Indonesia               Corn                     8925
United States           Wheat                    62099
United States           Rice                     7771
United States           Corn                     236064

Making Output Descriptive

There are several ways to customize SAS procedure output and DATA step output. You can change the look of output by adding informative titles, footnotes, and labels, and by changing the way the information is formatted on the page. The following list describes some of the statements and SAS system options that you can use.

CENTER | NOCENTER system option

controls whether output is centered. By default, SAS centers titles and procedure output on the page and on the personal computer display.

DATE | NODATE system option

controls printing of date and time values. When this option is enabled, SAS prints on the top of each page of output the date and time the SAS job started. When you run SAS in interactive mode, the date and time the job started is the date and time you started your SAS session.

FOOTNOTE statements

print footnotes at the bottom of each output page. You can also use the FOOTNOTES window for this purpose.


specifies the default output formatting characters for some procedures such as CALENDAR, FREQ, REPORT, and TABULATE.


specifies a character that is used to delimit page breaks in SAS output.

LABEL statement

associates descriptive labels with variables. With most procedure output, SAS writes the label rather than the variable name.

The LABEL statement also provides descriptive labels when it is used with certain SAS procedures. See Base SAS Procedures Guide for information on using the LABEL statement with a specific procedure (for example, the PRINT procedure).

LINESIZE= and PAGESIZE= system options

can change the default number of lines per page (page size) and characters per line (line size) for printed output. The default depends on the method of running SAS and the settings of certain SAS system options. Specify new page and line sizes in the OPTIONS statement or OPTIONS window. You can also specify line and page size for DATA step output in the FILE statement.

The values you use for the LINESIZE= and PAGESIZE= system options can significantly affect the appearance of the output that is produced by some SAS procedures.

NUMBER | NONUMBER and PAGENO= system options

control page numbering. The NUMBER system option controls whether the page number prints on the first title line of each page of printed output. You can also specify a beginning page number for the next page of output produced by SAS by using the PAGENO= system option.

TITLE statements

print titles at the top of each output page. By default, SAS prints the following title:

  The SAS System

You can use the TITLE statement or TITLES window to replace the default title or specify other descriptive titles for SAS programs. You can use the null title statement (title; ) to suppress a TITLE statement.

See SAS Language Reference: Dictionary for more information about how to use these and other SAS system options and statements.

Reformatting Values

Certain SAS statements, procedures, and options enable you to print values using specified formats. You can apply or change formats with the FORMAT and ATTRIB statements, or with the VAR window in a windowing environment.

The FORMAT procedure enables you to design your own formats and informats, giving you added flexibility in displaying values. See the FORMAT procedure in Base SAS Procedures Guide for more information.

Printing Missing Values

SAS represents ordinary missing numeric values in a SAS listing as a single period, and missing character values as a blank space. If you specified special missing values for numeric variables, SAS writes the letter or the underscore. For character variables, SAS writes a series of blanks equal to the length of the variable.

The MISSING= system option enables you to specify a character to print in place of the period for ordinary missing numeric values.

Previous Page | Next Page | Top of Page