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
andKEEP
cannot precede theFILE
orTYPE
subcommands. -
DROP
andKEEP
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, theDROP
andKEEP
subcommands must refer to the field names, not the default column letters. - Variables can be specified in any order. Neither
DROP
norKEEP
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
andKEEP
subcommands are allowed; the effect is cumulative. Specifying a variable named on a previousDROP
or not named on a previousKEEP
results in an error and the command is not executed. - If you specify both
RANGE
andKEEP
, the resulting file contains only variables that are both within the range and specified onKEEP
. - If you specify both
RANGE
andDROP
, the resulting file contains only variables within the range and excludes those mentioned onDROP
, 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.