Imports observation values stored inside one or more series in a second workfile page into the attribute fields of objects within the current workfile page.
Syntax
importattr(options) source_page [@keep keeplist @drop droplist]
The source page should contain one series whose values are the names of the objects into which the attributes should be imported, and one or more additional series containing the values of each attribute to be imported. By default, the procedure will assume there is an alpha series called NAME in the source page that contains the object names. The “name=” option can be used to specify that a different series in the source page contains the object names.
Values in the name column will always be converted into legal EViews names before matching to object names in the current workfile. (For example, any spaces will be replaced by underscores.)
Typically, the name of the series in the source workfile will be used as the attribute name inside the current workfile. However, if an object in the source workfile has a display name set, this value will be used for the attribute name instead. Display names must be used to specify attribute names if your attribute names contain spaces since spaces are not allowed within EViews object names.
For numeric series, attribute values will be imported using the formatting currently set for the series spreadsheet view of the source series.
By default, all series in the source page will be used as attribute values (except the series containing object names). To import only a subset of series as attributes, name patterns can be provided in the @keep and @drop arguments to restrict which series will be used.
importattr is most often useful when importing custom attributes from an external file. It is common for foreign data files, such as Excel files, to have one file (or sheet in Excel) containing the data, and a separate file (or sheet) containing the attributes, or meta-data, of each series. In such cases the pageload command can be used to read in the attribute file as a separate page in your workfile, and then importattr can be used to assign them to the data page.
Options
mode=arg | Specify how the procedure treats existing attribute values in the current workfile page. arg may be "o" or "overwrite" (clears all existing attribute values in the object before applying the imported attribute value), “u” or “update” (clears existing attribute values only for the attributes that are being imported), “m” or “merge” (keeps existing values if the imported value of the attribute is empty), “md” (keeps all existing non-empty values. only empty values will be replaced with the imported values). |
trim=string | Remove string from the start and end of the attribute name. |
name=arg | Specify the name of the alpha series in the source page containing the names of objects in the target page. |
Examples
importattr(name=objnames) attributes @keep attr1 attr2
Imports values from series ATTR1 and ATTR2 in the page “Attributes” into attributes “attr1” and “attr2” of objects in the current workfile. The series OBJNAMES in the page “Attributes” specifies which objects in the current workfile should have their attribute values updated.
importattr(name=objnames, trim=":") attributes @keep attr1 attr2
removes the “:” from the start and end of the attribute name, if present, since EViews adds that character in the label view.
Cross-references
See
“Workfile Details Display” and
“Label”for a discussion of the workfile details display and, for example, the series object label view.