SAS OnlineTutor HomeFAQ PageSuggested Learning PathContents+Searchback||next

Creating Enhanced List and Summary Reports
Defining Column Attributes


Specifying Column Widths

In the previous example of SAS listing output, you might have noticed that several headings were wrapped over two lines. (In HTML output, the longest cell value determines the column width, so wrapping doesn't occur.)

If a variable in the input data set doesn't have a format associated with it, the default PROC REPORT column width is

  • the variable's length for character variables
  • 9 for numeric variables.

The character variables Flight, Orig, and Dest each have a length of 3, and no format is associated with them. So 3 is their default column width.


Partial PROC REPORT Output, SAS Listing
 Fli
 ght
  Ori
  g
  Des
  t
Mail Freight Revenue 
 821   LGA   LON         403         209   $150,634.00 
 271   LGA   PAR         492         308   $156,804.00 
 271   LGA   PAR         366         498   $190,098.00 
 821   LGA   LON         345         243   $150,634.00 
 821   LGA   LON         248         307   $193,930.00 


To specify a width for columns in your report, use the WIDTH= attribute in the DEFINE statement. You can specify values from 1 to the value of the LINESIZE= system option.

The WIDTH= attribute has no effect on HTML output.


Example

To specify column widths that accommodate the column headings for Flight, Orig, and Dest, you can use the following DEFINE statements in your PROC REPORT step:

     proc report data=flights.europe nowd;
        where dest in ('LON','PAR');
        column flight orig dest mail freight revenue;
        define revenue / format=dollar15.2;
        define flight / width=6;
        define orig / width=4;
        define dest / width=4;
     run;
Now the headings appear on one line.


Partial PROC REPORT Output, SAS Listing
 Flight   Orig   Dest Mail Freight Revenue 
 821   LGA   LON         403         209   $150,634.00 
 271   LGA   PAR         492         308   $156,804.00 
 271   LGA   PAR         366         498   $190,098.00 
 821   LGA   LON         345         243   $150,634.00 
 821   LGA   LON         248         307   $193,930.00 


back||next


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

Terms of Use & Legal Information | Privacy Statement