Object Reference : Object View and Procedure Reference : Link
  
 
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.