9.1 APPLY DICTIONARY
APPLY DICTIONARY FROM={’file_name’,file_handle}.
APPLY DICTIONARY
applies the variable labels, value labels,
and missing values taken from a file to corresponding
variables in the active dataset. In some cases it also updates the
weighting variable.
Specify a system file or portable file’s name, a data set name
(see Datasets), or a file handle name (see File Handles). The
dictionary in the file will be read, but it will not replace the
active dataset’s dictionary. The file’s data will not be read.
Only variables with names that exist in both the active dataset and the
system file are considered. Variables with the same name but different
types (numeric, string) will cause an error message. Otherwise, the
system file variables’ attributes will replace those in their matching
active dataset variables:
- If a system file variable has a variable label, then it will replace
the variable label of the active dataset variable. If the system
file variable does not have a variable label, then the active dataset
variable’s variable label, if any, will be retained.
- If the system file variable has custom attributes (see VARIABLE ATTRIBUTE), then those attributes replace the active dataset variable’s
custom attributes. If the system file variable does not have custom
attributes, then the active dataset variable’s custom attributes, if any,
will be retained.
- If the active dataset variable is numeric or short string, then value
labels and missing values, if any, will be copied to the active dataset
variable. If the system file variable does not have value labels or
missing values, then those in the active dataset variable, if any, will not
be disturbed.
In addition to properties of variables, some properties of the active
file dictionary as a whole are updated:
- If the system file has custom attributes (see DATAFILE ATTRIBUTE),
then those attributes replace the active dataset variable’s custom
attributes.
- If the active dataset has a weighting variable (see WEIGHT), and the
system file does not, or if the weighting variable in the system file
does not exist in the active dataset, then the active dataset weighting
variable, if any, is retained. Otherwise, the weighting variable in
the system file becomes the active dataset weighting variable.
APPLY DICTIONARY
takes effect immediately. It does not read the
active dataset. The system file is not modified.