Command Reference : Object and Command Basics : Auxiliary Commands
  
Auxiliary Commands
 
Managing Workfiles and Databases
Managing Workfiles
Managing Databases
Managing Objects
Copying Objects
Copy with Wildcard Characters
Renaming Objects
Deleting Objects
Saving Objects
Fetch Objects
Auxiliary commands are commands which are unrelated to a particular object (i.e., are not object views or procs), or act on an object in a way that is generally independent of the type or contents of the object. Many of the important auxiliary commands are used for managing objects, and object containers. A few of the more important commands are described below.
Auxiliary commands typically follow the syntax:
command(option_list) argument_list
where command is the name of the command, option_list is a list of options separated by commas, and argument_list is a list of arguments generally separated by spaces.
An example of an auxiliary command is:
store(d=c:\newdata\db1) gdp m x
which will store the three objects GDP, M and X in the database named DB1 in the directory C:\NEWDATA.
Managing Workfiles and Databases
There are two types of object containers: workfiles and databases. All EViews objects must be held in an object container, so before you begin working with objects you must create a workfile or database. Workfiles and databases are described in depth in “Workfile Basics” and “EViews Databases”.
Managing Workfiles
To declare and create a new workfile, you may use the wfcreate command. You may enter the keyword wfcreate followed by a name for the workfile, an option for the frequency of the workfile, and the start and end dates. The most commonly used workfile frequency type options are:
 
a
annual.
s
semi-annual.
q
quarterly.
m
monthly.
w
weekly.
d
daily (5 day week).
7
daily (7 day week).
u
undated/unstructured.
but there are additional options for multi-year, bimonthly, fortnight, ten-day, daily with custom week, intraday, integer date, and undated frequency workfiles.
For example:
wfcreate macro1 q 1965Q1 1995Q4
creates a new quarterly workfile named MACRO1 from the first quarter of 1965 to the fourth quarter of 1995.
wfcreate cps88 u 1 1000
creates a new undated workfile named CPS88 with 1000 observations.
Alternately, you may use wfopen to read a foreign data source into a new workfile.
If you have multiple open workfiles, the wfselect commandmay be used to change the active workfile.
To save the active workfile, use the wfsave commandby typing the keyword wfsave followed by a workfile name. If any part of the path or workfile name has spaces, you should enclose the entire expression in quotation marks. The active workfile will be saved in the default path under the given name. You may optionally provide a path to save the workfile in a different directory:
wfsave a:\mywork
If necessary, enclose the path name in quotations.
To close the workfile, use the close command. For example:
close mywork
closes the workfile window of MYWORK.
To open a previously saved workfile, use the wfopen command. You should follow the keyword with the name of the workfile. You can optionally include a path designation to open workfiles that are not saved in the default path. For example:
wfopen "c:\mywork\proj1"
Managing Databases
To create a new database, follow the dbcreate command keywordwith a name for the new database. Alternatively, you could use the db command keywordfollowed by a name for the new database. The two commands differ only when the named database already exists.
If you use dbcreate and the named database already exists on disk, EViews will error indicating that the database already exits. If you use db and the named database already exists on disk, EViews will simply open the existing database. Note that the newly opened database will become the default database.
For example:
dbcreate mydata1
creates a new database named MYDATA1 in the default path, opens a new database window, and makes MYDATA1 the default database.
db c:\evdata\usdb
opens the USDB database in the specified directory if it already exists. If it does not, EViews creates a new database named USDB, opens its window, and makes it the default database.
You may use dbopen to open an existing database and to make it the default database. For example:
dbopen findat
opens the database named FINDAT in the default directory. If the database does not exist, EViews will error indicating that the specified database cannot be found.
You may use dbrename to rename an existing database. Follow the dbrename keyword by the current (old) name and a new name:
dbrename temp1 newmacro
To delete an existing database, use the dbdelete command. Follow the dbdelete keyword by the name of the database to delete:
dbdelete c:\data\usmacro
dbcopy makes a copy of the existing database. Follow the dbcopy keyword with the name of the source file and the name of the destination file:
dbcopy c:\evdata\macro1 a:\macro1
dbpack and dbrebuild are database maintenance commands. See also “EViews Databases” for a detailed description.
Managing Objects
In the course of a program you will often need to manage the objects in a workfile by copying, renaming, deleting and storing them to disk. EViews provides a number of auxiliary commands which perform these operations. The following discussion introduces you to the most commonly used commands; a full description of these, and other commands is provided in “Command Reference”.
Copying Objects
You may create a duplicate copy of one or more objects using the copy command. The copy command is an auxiliary command with the format:
copy source_name dest_name
where source_name is the name of the object you wish to duplicate, and dest_name is the name you want attached to the new copy of the object.
The copy command may also be used to copy objects in databases and to move objects between workfiles and databases.
Copy with Wildcard Characters
EViews supports the use of wildcard characters (“?” for a single character match and “*” for a pattern match) in destination specifications when using the copy and rename commands. Using this feature, you can copy or rename a set of objects whose names share a common pattern in a single operation. This features is useful for managing series produced by model simulations, series corresponding to pool cross-sections, and any other situation where you have a set of objects which share a common naming convention.
A destination wildcard pattern can be used only when a wildcard pattern has been provided for the source, and the destination pattern must always conform to the source pattern in that the number and order of wildcard characters must be exactly the same between the two. For example, the patterns:
 
Source Pattern
Destination Pattern
x*
y*
*c
b*
x*12?
yz*f?abc
conform to each other. These patterns do not:
 
Source Pattern
Destination Pattern
a*
b
*x
?y
x*y*
*x*y*
When using wildcards, the destination name is formed by replacing each wildcard in the destination pattern by the characters from the source name that matched the corresponding wildcard in the source pattern. Some examples should make this principle clear:
 
Source Pattern
Destination Pattern
Source Name
Destination Name
*_base
*_jan
x_base
x_jan
us_*
*
us_gdp
gdp
x?
x?f
x1
x1f
*_*
**f
us_gdp
usgdpf
??*f
??_*
usgdpf
us_gdp
Note, as shown in the second example, that a simple asterisk for the destination pattern does not mean to use the unaltered source name as the destination name. To copy objects between containers preserving the existing name, either repeat the source pattern as the destination pattern,
copy x* db1::x*
or omit the destination pattern entirely:
copy x* db1::
If you use wildcard characters in the source name and give a destination name without a wildcard character, EViews will keep overwriting all objects which match the source pattern to the name given as destination.
For additional discussion of wildcards, see Appendix A. “Wildcards”
Renaming Objects
You can give an object a different name using the rename command. The rename command has the format:
rename source_name dest_name
where source_name is the original name of the object and dest_name is the new name you would like to give to the object.
rename can also be used to rename objects in databases.
You may use wildcards when renaming series. The name substitution rules are identical to those described above for copy.
Deleting Objects
Objects may be removed from the workfile or a database using the delete command. The delete command has the format:
delete name_pattern
where name_pattern can either be a simple name such as “XYZ”, or a pattern containing the wildcard characters “?” and “*”, where “?” means to match any one character, and “*” means to match zero or more characters. When a pattern is provided, all objects in the workfile with names matching the pattern will be deleted. Appendix A. “Wildcards” describes further the use of wildcards.
Saving Objects
All named objects will be saved automatically in the workfile when the workfile is saved to disk. You can store and retrieve the current workfile to and from disk using the wfsave and wfopen commands. Unnamed objects will not be saved as part of the workfile.
You can also save objects for later use by storing them in a database. The store command has the format:
store(option_list) object1 object2
where object1, object2, ..., are the names of the objects you would like to store in the database. If no options are provided, the series will be stored in the current default database (see “EViews Databases” for a discussion of the default database). You can store objects into a particular database by using the option “d=db_name” or by prepending the object name with a database name followed by a double colon “::”, such as:
store db1::x db2::x
Fetch Objects
You can retrieve objects from a database using the fetch command. The fetch command has the same format as the store command:
fetch(option_list) object1 object2
To specify a particular database use the “d=” option or the “::” extension as for store.