Command Reference : Command Reference
  
 
fetch
Fetch objects from databases or databank files into the workfile.
fetch reads one or more objects from EViews databases or databank files into the active workfile. The objects are loaded into the workfile using the object in the database or using the databank file name.
If you fetch a series into a workfile with a different frequency, EViews will automatically apply the frequency conversion method attached to the series by setconvert. If the series does not have an attached conversion method, EViews will use the method set by Options/Date-Frequency in the main menu. You can override the conversion method by specifying an explicit conversion method option.
Syntax
fetch(options) object_list
The fetch command keyword is followed by a list of object names separated by spaces. The default behavior is to fetch the objects from the default database (this is a change from versions of EViews prior to EViews 3.x where the default was to fetch from individual databank files).
You can precede the object name with a database name and the double colon “::” to indicate a specific database source. If you specify the database name as an option in parentheses (see below), all objects without an explicit database prefix will be fetched from the specified database. You may optionally fetch from individual databank files or search among registered databases.
You may use wild card characters, “?” (to match a single character) or “*” (to match zero or more characters), in the object name list. All objects with names matching the pattern will be fetched.
To fetch from individual databank files that are not in the default path, you should include an explicit path. If you have more than one object with the same file name (for example, an equation and a series named CONS), then you should supply the full object file name including identifying extensions.
Options
 
d=db_name
Fetch from specified database.
d
Fetch all registered databases in registry order.
i
Fetch from individual databank files.
link
Fetch as a database link.
notifyillegal
When in a program, report illegal EViews object names. By default, objects with illegal names are automatically renamed. (Has no effect in the command window.)
p=prefix
Specify a naming prefix that will be prepended to the listed names to be fetched.
s=suffix
Specify a naming suffix that will be appended to the listed names to be fetched.
pi=prefix
Specify a naming prefix that will be removed from the name of the source objects once fetched into the workfile.
si=suffix
Specify a naming suffix that will be removed from the name of the source objects once fetched into the workfile.
tr=integer
Truncate long series names to integer characters. The default value of integer is 24.
The following options are available for fetch of group objects:
 
g=arg
Group fetch options: “b” (fetch both group definition and series), “d” (fetch only the series in the group), “l” (fetch only the group definition).
The database specified by the double colon “::” takes precedence over the database specified by the “d=” option.
The following options control the frequency conversion method when copying series and group objects into a workfile page and converting from low to high frequency:
 
c=arg
Low to high conversion methods: “r” or “repeata” (constant match average), “d” or “repeats” (constant match sum), “q” or “quada” (quadratic match average), “t” or “quads” (quadratic match sum), “linearf” (linear match first), “i” or “linearl” (linear match last), “cubicf” (cubic match first), “c” or “cubicl” (cubic match last), “pointf” (point first), “pointl” (point last).
The following options control the frequency conversion method when copying series and group objects to a workfile, 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).
If no conversion method is specified, the series-specific or global default conversion method will be employed.
Examples
To fetch M1, GDP, and UNEMP from the default database, use:
fetch m1 gdp unemp
To fetch M1 and GDP from the US1 database and UNEMP from the MACRO database, use the command:
fetch(d=us1) m1 gdp macro::unemp
You can fetch all objects with names starting with “SP” by searching all registered databases in the search order. The “c=f” option uses the first (nonmissing) observation to convert the frequency of any matching series with a higher frequency than the destination workfile frequency:
fetch(d,c=f) sp*
You can fetch M1 and UNEMP from individual databank files using:
fetch(i) m1 c:\data\unemp
To fetch all objects with names starting with “CONS” from the two databases USDAT and UKDAT, use the command:
fetch usdat::cons* ukdat::cons*
The command:
fetch a?income
will fetch all series beginning with the letter “A”, followed by any single character, and ending with the string “income”.
Use the “notifyillegal” option to display a dialog when fetching the series MYILLEG@LNAME that will suggest a valid name and give you to opportunity to name the object before it is inserted into a workfile:
fetch(notifyillegal) myilleg@lname
The command:
fetch(p=us_) gdp inv cons
Fetches the series US_GDP, US_INV and US_CONS into workfile series with the same names.
fetch(si=” us equity”) ibm msft
Fetches the database series IBM US EQUITY, and MSFT US EQUITY into workfile series with names IBM and MSFT.
Specifying the “tr” option causes EViews 10 to truncate long series names to 24 characters (by default) instead of 300. This will let programs written for EViews 9 continue to work with EViews 10:
fetch(d=eia, link, tr) coal.average_employees.al-tot.a
The “tr” option can also be set to a number between 0 and 300:
fetch(d=eia, link, tr=20) coal.average_employees.al-tot.a
Cross-references
See “EViews Databases” for a discussion of databases, databank files, and frequency conversion. Appendix A. “Wildcards” describes the use of wildcard characters.
See also store, and copy.
See Series::setconvert for information on default conversion settings.