Overview (FLIP command)

The program requires a file structure in which the variables are the columns and observations (cases) are the rows. If a file is organized such that variables are in rows and observations are in columns, you need to use FLIP to reorganize it. FLIP transposes the rows and columns of the data in the active dataset so that, for example, row 1, column 2 becomes row 2, column 1, and so forth.

Options

Variable Subsets. You can transpose specific variables (columns) from the original file using the VARIABLES subcommand.

Variable Names. You can use the values of one of the variables from the original file as the variable names in the new file, using the NEWNAMES subcommand.

Basic Specification

The basic specification is the command keyword FLIP, which transposes all rows and columns.

  • By default, FLIP assigns variable names VAR001 to VARn to the variables in the new file. It also creates the new variable CASE_LBL, whose values are the variable names that existed before transposition.

Subcommand Order

VARIABLES must precede NEWNAMES.

Operations

  • FLIP replaces the active dataset with the transposed file and displays a list of variable names in the transposed file.
  • FLIP discards any previous VARIABLE LABELS, VALUE LABELS, and WEIGHT settings. Values defined as user-missing in the original file are translated to system-missing in the transposed file.
  • FLIP obeys any SELECT IF, N, and SAMPLE commands in effect.
  • FLIP does not obey the TEMPORARY command. Any transformations become permanent when followed by FLIP.
  • String variables in the original file are assigned system-missing values after transposition.
  • Numeric variables are assigned a default format of F8.2 after transposition (with the exceptions of CASE_LBL and the variable specified on NEWNAMES).
  • The variable CASE_LBL is created and added to the active dataset each time FLIP is executed.
  • If CASE_LBL already exists as the result of a previous FLIP, its current values are used as the names of variables in the new file (if NEWNAMES is not specified).