DROP and KEEP Subcommands (GET TRANSLATE command)

DROP and KEEP are used to copy a subset of variables into the active dataset. DROP specifies the variables not to copy into the active dataset. KEEP specifies the variables to copy. Variables not specified on KEEP are dropped.

  • DROP and KEEP cannot precede the FILE or TYPE subcommands.
  • DROP and KEEP specifications use variable names. By default, this program uses the column letters from spreadsheets and the field names from databases as variable names.
  • If FIELDNAMES is specified when translating from a spreadsheet, the DROP and KEEP subcommands must refer to the field names, not the default column letters.
  • Variables can be specified in any order. Neither DROP nor KEEP affects the order of variables in the resulting file. Variables are kept in their original order.
  • If a variable is referred to twice on the same subcommand, only the first mention of the variable is recognized.
  • Multiple DROP and KEEP subcommands are allowed; the effect is cumulative. Specifying a variable named on a previous DROP or not named on a previous KEEP results in an error and the command is not executed.
  • If you specify both RANGE and KEEP, the resulting file contains only variables that are both within the range and specified on KEEP.
  • If you specify both RANGE and DROP, the resulting file contains only variables within the range and excludes those mentioned on DROP, even if they are within the range.

Example

GET TRANSLATE FILE='ADDRESS.DBF' /DROP=PHONENO, ENTRY.
  • GET TRANSLATE creates an active dataset from the dBASE file ADDRESS.DBF, omitting the fields named PHONENO and ENTRY.

Example

GET TRANSLATE FILE='PROJECT.OCT' /TYPE=WK1 /FIELDNAMES
 /KEEP=NETINC, REP, QUANTITY, REGION, MONTH, DAY, YEAR.
  • GET TRANSLATE creates a active dataset from the 1-2-3 Release 2.0 file called PROJECT.OCT.
  • The subcommand FIELDNAMES indicates that the first row of the spreadsheet contains field names, which will be translated into variable names in the active dataset.
  • The subcommand KEEP translates columns with the field names NETINC, REP, QUANTITY, REGION, MONTH, DAY, and YEAR to the active dataset.