Overview (PRINT command)

PRINT displays the values of variables for each case in the data. PRINT is simple enough for a quick check on data definitions and transformations and flexible enough for formatting simple reports.

Options

Formats. You can specify formats for the variables (see Formats).

Strings. You can specify string values within the variable specifications. The strings can be used to label values or to create extra space between values. Strings can also be used as column headings. (See Strings.)

Output File. You can use the OUTFILE subcommand to direct the output to a specified file.

Summary Table. You can use the TABLE subcommand to display a table that summarizes variable formats.

Basic Specification

The basic specification is a slash followed by a variable list. The output displays values for all variables that are named on the list.

Subcommand Order

Subcommands can be specified in any order. However, all subcommands must be specified before the slash that precedes the start of the variable specifications.

Syntax Rules

  • A slash must precede the variable specifications. The first slash begins the definition of the first (and possibly only) line per case of the PRINT display.
  • Specified variables must already exist, but they can be numeric, string, scratch, temporary, or system variables. Subscripted variable names, such as X(1) for the first element in vector X, cannot be used.
  • Keyword ALL can be used to display the values of all user-defined variables in the active dataset.

Operations

  • PRINT is executed once for each case that is constructed from the data file.
  • PRINT is a transformation and is not executed unless it is followed by a procedure or the EXECUTE command.
  • Because PRINT is a transformation command, the output might be mixed with casewise procedure output. Procedures that produce individual case listings (such as LIST) should not be used immediately after PRINT. An intervening EXECUTE or procedure command should be specified.
  • Values are displayed with a blank space between them. However, if a format is specified for a variable, the blank space for that variable’s values is suppressed.
  • Values are displayed in the output as the data are read. The PRINT output appears before the output from the first procedure.
  • If more variables are specified than can be displayed in 132 columns or within the width that is specified on SET WIDTH, the program displays an error message. You must reduce the number of variables or split the output into several records.
  • User-missing values are displayed exactly like valid values. System-missing values are represented by a period.