Object Reference : Object View and Procedure Reference : Link
  
Link
 
String values
clearhist
clearremarks
copy
display
displayname
label
link
linkto
General Match Merge Link Options
Frequency Conversion Link Options
General Match Merge Linking
Frequency Conversion Linking
olepush
setattr
Link object. Series or alpha link used to frequency converted or match merge data from another workfile page.
Once created, links may be used just like the corresponding “Series” or “Alpha” objects.
Link Declaration
link link object declaration.
To declare a link object, enter the keyword link, followed by a name:
link newser
and an optional link specification:
link altser.linkto(c=obs,nacat) indiv::x @src ind1 ind2 @dest ind1 ind2
Link Views
display display table, graph, or spool in object window.
label label information for the link.
Link Procs
clearhist clear the contents of the history attribute.
clearremarks clear the contents of the remarks attribute.
copy creates a copy of the link.
displayname set display name.
linkto specify link object definition.
olepush push updates to OLE linked objects in open applications.
setattr set the value of an object attribute.
Link Data Members
String values
@attr("arg") string containing the value of the arg attribute, where the argument is specified as a quoted string.
@description string containing the description (if available).
@detailedtype string with the object type: “LINK”.
@displayname string containing display name. If the Link object has no display name set, the name is returned.
@first string containing the date or observation number of the first non-missing observation of the Link. In a panel workfile, the first date at which any cross-section has a non-missing observation is returned.
@firstall returns the same as @first, however in a panel workfile, the first date at which all cross-sections have a non-missing observation is returned.
@last string containing the date or observation number of the last non-blank observation of the alpha. In a panel workfile, the last date at which any cross-section has a non-missing observation is returned.
@lastall returns the same as @last, however in a panel workfile, the last date at which all cross-sections have a non-missing observation is returned.
@name string containing the Link’s name.
@remarks string containing the Link’s remarks (if available).
@type string with the series object type: “SERIES” or “ALPHA”.
@updatetime string representation of the time and date at which the Link was last updated.
clearhist
Clear the contents of the history attribute.
Removes the rowvector’s history attribute, as shown in the label view of the rowvector.
Syntax
rowvector_name.clearhist
Examples
r1.clearhist
r1.label
The first line removes the history from the rowvector R1, and the second line displays the label view of R1, including the now blank history field.
Cross-references
See “Labeling Objects” for a discussion of labels and display names.
See also Link::label.
clearremarks
Clear the contents of the remarks attribute.
Removes the link’s remarks attribute, as shown in the label view of the link.
Syntax
link_name.clearremarks
Examples
l1.clearremarks
l1.label
The first line removes the remarks from the link L1, and the second line displays the label view of L1, including the now blank remarks field.
Cross-references
See “Labeling Objects” for a discussion of labels and display names.
See also Link::label.
copy
Creates a copy of the link.
Creates either a named or unnamed copy of the link.
Syntax
link_name.copy
link_name.copy dest_name
Examples
L1.copy
creates an unnamed copy of the link L1.
L1.copy L2
creates L2, a copy of the link L1.
Cross-references
See also copy.
display
Display table, graph, or spool output in the link object window.
Display the contents of a table, graph, or spool in the window of the object.
Syntax
link_name.display object_name
Examples
link1.display tab1
Display the contents of the table TAB1 in the window of the object LINK1.
Cross-references
Most often used in constructing an EViews Add-in. See “Custom Object Output”.
displayname
Display names for a link object.
Attaches a display name to a link object which may be used to label output in tables and graphs in place of the standard link object name.
Syntax
link_name.displayname display_name
Display names are case-sensitive, and may contain a variety of characters, such as spaces, that are not allowed in link object names.
Examples
hrs.displayname Hours Worked
hrs.label
The first line attaches a display name “Hours Worked” to the link object HRS, and the second line displays the label view of HRS, including its display name.
gdp.displayname US Gross Domestic Product
plot gdp
The first line attaches a display name “US Gross Domestic Product” to the link object GDP. The line graph view of GDP from the second line will use the display name as the legend.
Cross-references
See “Labeling Objects” for a discussion of labels and display names.
See also Link::label and Graph::legend.
label
Display or change the label view of the link object, including the last modified date and display name (if any).
As a procedure, label changes the fields in the link object label.
Syntax
link_name.label
link_name.label(options) [text]
Options
The first version of the command displays the label view of the link. The second version may be used to modify the label. Specify one of the following options along with optional text. If there is no text provided, the specified field will be cleared.
c
Clears all text fields in the label.
d
Sets the description field to text.
s
Sets the source field to text.
u
Sets the units field to text.
r
Appends text to the remarks field as an additional line.
p
Print the label view.
Examples
The following lines replace the remarks field of the link object LWAGE with “Data from CPS 1988 March File”:
lwage.label(r)
lwage.label(r) Data from CPS 1988 March File
To append additional remarks to LWAGE, and then to print the label view:
lwage.label(r) Log of hourly wage
lwage.label(p)
To clear and then set the units field, use:
lwage.label(u) Millions of bushels
Cross-references
See “Labeling Objects” for a discussion of labels.
See also Link::displayname.
link
Create a series link object.
Declares a link object which may be used to refer to data in a series contained in a different workfile page. Links are used to create automatically updating match merges using identifier series or using dates (frequency conversion).
Syntax
link link_name
link link_name.linkto(options) link specification
Follow the link keyword with the name to be given to the link object. If desired, you may combine the declaration with the Link::linkto proc in order to provide a full link specification.
Examples
link mylink
creates the link MYLINK with no link specification, while,
link l1.linkto(c=obs,nacat) indiv\x @src ind1 ind2 @dest ind1 ind2
combines the link declaration with the link specification step.
Cross-references
For a discussion of linking, see “Series Links”.
See also Link::linkto and unlink.
linkto
Define the specification of a series link.
Specify the method by which the object uses data in an existing series. Links are used to perform cross-page match merging or frequency conversion.
Syntax
link_name.linkto(options) source_page\series_name [src_id dest_id]
link_name.linkto(options) source_page\series_name [@src src_ids @dest dest_ids]
The most common use of linkto will be to define a link that employs general match merging. You should use the keyword linkto followed by any desired options, and then provide the name of the source series followed by the names of the source and destination IDs. If more than one identifier series is used, you must separate the source and destination IDs using the “@SRC” and “@DEST” keywords.
In the special case where you wish to link your data using date matching, you must use the special keyword “@DATE” as an ID series for a regular frequency page. If “@DATE” is not specified as either a source or destination ID, EViews will perform an exact match merge using the specified identifiers.
The other use of linkto will be to define a frequency conversion link between two date structured pages. To specify a frequency conversion link, you should use the linkto keyword followed by any desired options and then the name of a numeric source series. You must not specify ID series since a frequency conversion link uses the implicit dates associated with the regular frequency pages—if ID series are specified, the link will instead employ general match merging. Note also that if ID series are not specified, but a general match merge specific conversion option is provided (e.g., “c=med”), “@DATE @DATE” will be appended to the list of IDs and a general match merge employed.
When performing frequency conversion (where ID series are not provided) where either of the pages are undated, EViews will perform a raw copy link, in which the first observation in the source workfile page is copied into the first observation in the destination page, the second observation in the source into the second observation in the destination, and so forth.
It is worth mentioning that a frequency conversion link that uses an alpha source series will generate an evaluation error.
Note that linking by frequency conversion is the same as linking by general match merge using the source and destination IDs “@DATE @DATE” with the following exceptions:
General match merge linking offers contraction methods not available with frequency conversion (e.g., median, variance, skewness).
General match merge linking allows you to use samples to restrict the source observations used in evaluating the link.
General match merge linking allows you to treat NA values in the ID series as a category to be used in matching.
Frequency conversion linking offers expansion methods other than repeat.
Frequency conversion linking provides options for the handling of NA values.
Note that frequency conversion linking with panel structured pages offers special handling:
If both pages are dated panel pages that are structured with a single identifier, EViews will perform frequency conversion cross-section by cross-section.
Conversion from a dated panel page to a dated, non-panel page will first perform a mean contraction across cross-sections to obtain a single time series (by computing the means for each period), and then a frequency conversion of the resulting time series to the new frequency.
Conversion from a dated, non-panel page to a dated panel page will first involve a frequency conversion of the single time series to the new frequency. The converted time series will be used for each cross-section in the panel page.
In all three of these cases, all of the high-to-low conversion methods are supported, but low-to-high frequency conversion only offers Constant-match average (repeating of the low frequency observations).
Lastly, frequency conversion involving a panel page with more than one dimension or an undated page will default to raw data copy unless general match merge options are provided.
Options
General Match Merge Link Options
The following options are available when linking with general match merging:
smpl= smpl_spec
Sample to be used when computing contractions in a link by match merge. Either provide the sample range in double quotes or specify a named sample object. By default, EViews will use the entire workfile sample “@ALL”.
c=arg
Set the match merge contraction or the frequency conversion method.
If you are linking a numeric source series by general match merge, the argument can be one of: “mean”, “med” (median), “max”, “min”, “sum”, “sumsq” (sum-of-squares), “var” (variance), “sd” (standard deviation), “skew” (skewness), “kurt” (kurtosis), “quant” (quantile, used with “quant=” option), “obs” (number of observations), “nas” (number of NA values), “first” (first observation in group), “last” (last observation in group), “unique” (single unique group value, if present), “none” (disallow contractions).
If linking an alpha series, only the non-summary methods “max”, “min”, “obs”, “nas”, first”, “last”, “unique” and “none” are supported. For numeric links, the default contraction method is “c=mean”; for alpha links, the default is “c=unique”.
If you are linking by frequency conversion, you may use this argument to specify the up- or down-conversion method using the options found in fetch. The default frequency conversion methods are taken from the series defaults.
quant=number
Quantile value to be used when contracting using the “c=quant” option (e.g, “quant=.3”).
nacat
Treat “NA” values as a category when performing link by general match merge operations.
Most of the conversion options should be self-explanatory. As for the others: “first” and “last” give the first and last non-missing observed for a given group ID; “obs” provides the number of non-missing values for a given group; “nas” reports the number of NAs in the group; “unique” will provide the value in the source series if it is the identical for all observations in the group, and will return NA otherwise; “none” will cause the link to fail if there are multiple observations in any group—this setting may be used if you wish to prohibit all contractions.
On a match merge expansion, linking by ID will repeat the values of the source for every matching value of the destination. If both the source and destination have multiple values for a given ID, EViews will first perform a contraction in the source (if not ruled out by “c=none”), and then perform the expansion by replicating the contracted value in the destination.
Frequency Conversion Link Options
If the linkto command does not specify identifier series, EViews will link series data using frequency conversion where appropriate.
The following options control the frequency conversion method when creating a frequency conversion link, converting from low to high frequency:
c=arg
Low to high conversion methods: “r” (constant match average), “d” (constant match sum), “q” (quadratic match average), “t” (quadratic match sum), “i” (linear match last), “c” (cubic match last).
The following options control the frequency conversion method when creating a frequency conversion link, converting from high to low frequency:
c=arg
High to low conversion methods removing NAs: “a” (average of the nonmissing observations), “s” (sum of the nonmissing observations), “f” (first nonmissing observation), “l” (last nonmissing observation), “x” (maximum nonmissing observation), “m” (minimum nonmissing observation).
High to low conversion methods propagating NAs: “an” or “na” (average, propagating missings), “sn” or “ns” (sum, propagating missings), “fn” or “nf” (first, propagating missings), “ln” or “nl” (last, propagating missings), “xn” or “nx” (maximum, propagating missings), “mn” or “nm” (minimum, propagating missings).
Note that if no conversion method is specified, the series specific default conversion method or the global settings will be employed.
Examples
General Match Merge Linking
Let us start with a concrete example. Suppose our active workfile page contains observations on the 50 states of the US, and contains a series called STATE containing the unique state identifiers. We also have a workfile page called INDIV that contains data on individuals from all over the country, their incomes (INCOME), and their state of birth (BIRTHSTATE).
Now suppose that we wish to find the median income of males in our data for each possible state of birth, and then to match merge that value into our 50 observation state page.
The following commands:
link male_income
male_income.linkto(c=med, smpl="if male=1") indiv\income birthstate state
create the series link MALE_INCOME. MALE_INCOME contains links to the individual INCOME data, telling EViews to subsample only observations where MALE=1, to compute median values for individuals in each BIRTHSTATE, and to match observations by comparing the values of BIRTHSTATE to STATE in the current page.
In this next example, we link to the series X in the INDIV page, matching values of the IND1 and the IND2 series in the two workfile pages. The link will compute the number of valid observations in the X series for each index group, with NA values in the ID series treated as a valid identifier value.
link l1.linkto(c=obs,nacat) indiv\x @src ind1 ind2 @dest ind1 ind2
You may wish to use the “@DATE” keyword as an explicit identifier, in order to gain access to our expanded date matching feature. In our annual workfile, the command:
link gdp.linkto(c=sd) monthly\gdp @date @date
will create link that computes the standard deviation of the values of GDP for each year and then match merges these values to the years in the current page. Note that this command is equivalent to:
link gdp.linkto(c=sd) quarterly\gdp
since the presence of the match merge option “c=sd” and the absence of indices instructs EViews to perform the link by ID matching using the defaults “@DATE” and “@DATE”.
Frequency Conversion Linking
Suppose that we are in an annual workfile page and wish to link data from a quarterly page. Then the commands:
link gdp
gdp.linkto quarterly\gdp
creates a series link GDP in the current page containing a link by date to the GDP series in the QUARTERLY workfile page. When evaluating the link, EViews will automatically frequency convert the quarterly GDP to the annual frequency of the current page, using the series default conversion options. If we wish to control the conversion method, we can specify the conversion method as an option:
gdp.linkto(c=s) quarterly\gdp
links to GDP in the QUARTERLY page, and will frequency convert by summing the non-missing observations.
Cross-references
For a detailed discussion of linking, see “Series Links”.
See Link::link. See also unlink, and copy.
olepush
Push updates to OLE linked objects in open applications.
Syntax
link_name.olepush
Cross-references
See “Object Linking and Embedding (OLE)” for a discussion of using OLE with EViews.
setattr
Set the object attribute.
Syntax
link_name.setattr(attr) attr_value
Sets the attribute attr to attr_value. Note that quoting the arguments may be required. Once added to an object, the attribute may be extracted using the @attr data member.
Examples
a.setattr(revised) never
String s = a.@attr("revised")
sets the “revised” attribute in the object A to the string “never”, and extracts the attribute into the string object S.
Cross-references
See “Adding Custom Attributes in the Label View” and “Adding Your Own Label Attributes”.