PRINT Procedure

Concepts: PRINT Procedure

Procedure Output

PROC PRINT always produces a printed report. You control the appearance of the report with statements and options. See the PRINT procedure examples starting for a sampling of the types of reports that the procedure produces.

Page Layout

Observations

By default, PROC PRINT uses an identical layout for all observations on a page of output. First, it attempts to print observations on a single line, as shown in the following figure.
Printing Observations on a Single Line
Printing Observations on a Single Line
If PROC PRINT cannot fit all the variables on a single line, it splits the observations into two or more sections and prints the observation number or the ID variables at the beginning of each line. For example, in the following figure, PROC PRINT prints the values for the first three variables in the first section of each page and the values for the second three variables in the second section of each page.
Splitting Observations into Multiple Sections on One Page
Splitting Observations into Multiple Sections on One Page
If PROC PRINT cannot fit all the variables on one page, the procedure prints subsequent pages with the same observations until it has printed all the variables. For example, in the following figure, PROC PRINT uses the first two pages to print values for the first three observations and the second two pages to print values for the rest of the observations.
Splitting Observations across Multiple Pages
Splitting Observations across Multiple Pages
Note: You can alter the page layout with the ROWS= option in the PROC PRINT statement. (See the discussion of ROWS= option.)
Note: PROC PRINT might produce slightly different output if the data set is not RADIX addressable. Version 6 compressed files are not RADIX addressable, while, beginning with Version 7, compressed files are RADIX addressable. (The integrity of the data is not compromised; the procedure simply numbers the observations differently.)

Column Headings

By default, spacing specifies whether PROC PRINT prints column headings horizontally or vertically. Printing Observations on a Single Line, Splitting Observations into Multiple Sections on One Page, and Splitting Observations across Multiple Pages all illustrate horizontal headings. The following figure illustrates vertical headings.
Using Vertical Headings
Using Vertical Headings
Note: If you use LABEL and at least one variable has a label, PROC PRINT prints all column headings horizontally unless you specify HEADING=VERTICAL.

Column Width

By default, PROC PRINT uses a variable's formatted width as the column width. (The WIDTH= option overrides this default behavior.) If the variable does not have a format that explicitly specifies a field width, PROC PRINT uses the widest data value for that variable on that page as the column width.
If the formatted value of a character variable or the data width of an unformatted character variable exceeds the line size minus the length of all the ID variables, PROC PRINT might truncate the value. Consider the following situation:
  • The line size is 80.
  • IdNumber is a character variable with a length of 10. It is used as an ID variable.
  • State is a character variable with a length of 2. It is used as an ID variable.
  • Comment is a character variable with a length of 200.
When PROC PRINT prints these three variables on a line, it uses 14 print positions for the two ID variables and the space after each one. This arrangement leaves 80–14, or 66, print positions for COMMENT. Longer values of COMMENT are truncated.
WIDTH= controls the column width.
Note: Column width is affected not only by variable width but also by the length of column headings. Long column headings might lessen the usefulness of WIDTH=.