Chapter Contents


The PRINT Procedure

Example 7: Controlling the Layout of a Report with Many Variables

Procedure features:
PROC PRINT statement options:
ID statement
Other features:
SAS data set options:

This example shows two ways of printing a data set with a large number of variables: one is the default, and the other uses ROWS=. For detailed explanations of the layouts of these two reports, see the ROWS= option and see Page Layout .

These reports use a pagesize of 24 and a linesize of 64 to help illustrate the different layouts.

Note:   When the two reports are written as HTML output, they do not differ.  [cautionend]


options nodate pageno=1 linesize=64 pagesize=24 ;
 Note about code
data empdata;
   input IdNumber $ 1-4 LastName $ 9-19 FirstName $ 20-29 
         City $ 30-42 State $ 43-44 /
         Gender $ 1 JobCode $ 9-11 Salary 20-29 @30 Birth date7.
         @43 Hired date7. HomePhone $ 54-65;
   format birth hired date7.;
1919    Adams      Gerald    Stamford     CT
M       TA2        34376     15SEP48      07JUN75    203/781-1255
1653    Alexander  Susan     Bridgeport   CT
F       ME2        35108     18OCT52      12AUG78    203/675-7715
. . . more lines
of data . . .
1407    Grant      Daniel    Mt. Vernon   NY
M       PT1        68096     26MAR57      21MAR78    914/468-1616
1114    Green      Janice    New York     NY
F       TA2        32928     21SEP57      30JUN75    212/588-1092
 Note about code
proc print data=empdata(obs=12);
   id idnumber;
   title 'Personnel Data';

 Note about code
proc print data=empdata(obs=12) rows=page;
   id idnumber;
   title 'Personnel Data';


Default Layout for a Report with Many Variables
In the traditional procedure output, each page of this report contains values for all variables in each observation. In the HTML output, this report is identical to the report that uses ROWS=PAGE.

Note that PROC PRINT automatically splits the variable names that are used as column headers at a change in capitalization if the entire name does not fit in the column. Compare, for example, the column headers for LastName (which fits in the column) and FirstName (which does not fit in the column).

[HTML Output]
 [Listing Output]

Layout Produced by the ROWS=PAGE Option
Each page of this report contains values for only some of the variables in each observation. However, each page contains values for more observations than the default report does. [HTML Output]
 [Listing Output]

Chapter Contents



Top of Page

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