User’s Guide : EViews Fundamentals : EViews Databases : Working with Objects in Databases
  
Working with Objects in Databases
 
Storing Objects in the Database
Fetching Objects from the Database
Database Export
Previewing Objects in the Database
Copying Objects
Copy-and-Paste
Drag-and-Drop
Copy Procedure
Renaming Objects in the Database
Deleting Objects From the Database
Store, Fetch, and Copy of Group Objects
Storing a Group Object
Fetching a Group Object
Copying Group Objects between Workfiles and Databases
Since databases are simply containers of other EViews objects, most of your work with databases will involve moving objects into and out of them. The sections on storing, fetching and exporting objects discuss different ways of doing this.
You will also need to manage the objects inside a database. You can examine previews of the objects to see their contents. You can create duplicate copies of objects, change their names, or remove them from the database entirely. The sections on previewing, copying, renaming and deleting objects discuss how these operations can be carried out.
Storing Objects in the Database
An object may be stored in a database in a number of ways. If you have a workfile open on the screen and would like to store objects contained inside it into a database, just select the objects from the workfile window with the mouse, then click on the Store button in the workfile toolbar. A sequence of dialogs will come up, one for each object selected, which provide a number of options for renaming the object and determining where the object should be stored.
By default, the object will be stored in the default database with the name used as the workfile. Click Yes to store the specified object. If you are storing more than one object, EViews will allow you to select Yes-to-All to store all of the objects using the current settings.
If you would like to store the object with a different name, simply type the new name over the old name in the Store object_name as edit box. If you would like to store the object in a different database, either enter the name of the new database in the text box marked Database Alias or Path (see “The Database Registry” for an explanation of database aliases), or click on the button marked Browse to select the database name interactively. To store the object to disk as an EViews .DB? file, click on the arrow to the right of the field labeled Store in and select Individual .DB? files. You may then specify a path in which to place the file using the field labeled Path for DB files.
If there is already an existing object in the database with the same name, EViews will display a dialog. The first and last of the three options should be self explanatory. The second option may only be used if the object you are storing from the workfile and the object already in the database are both series of the same frequency. In this case, EViews will merge the data from the two series so that the new series in the database has all the observations from the series being stored, as well as any observations from the existing series which have not been overwritten. For example, if the existing series in the database is an annual series from 1950 to 1990, and the series being stored is an annual series from 1980 to 1995, the new series will run from 1950 to 1995, with data from the existing series for 1950 to 1979, and data from the new series for 1980 to 1995.
Fetching Objects from the Database
There are a number of ways to fetch objects from a database, most of which are similar to the methods for storing.
The first method is to click on the button marked Fetch on the toolbar of the workfile into which you would like to fetch the object. A dialog will come up which is similar to the dialog for store:
The dialog allows you to specify the names of the objects to fetch, and the database or directory from which to retrieve them.
Enter the names of the objects you would like to fetch in the field Objects to Fetch. Alternatively, you can use the mouse to select objects from the workfile window before clicking on the Fetch button, in which case the names of these objects will appear automatically.
The fields labeled Database Alias or Path and Fetch from are the same as for the store dialog with one exception. In addition to EViews Database and Individual .DB? files, Fetch from has an option titled Search Databases. This option tells EViews to search multiple databases for objects which match the specified names. To use this option, you must first define a search order in the database registry (see “The Database Registry”).
The checkbox labeled Link objects to database on the bottom of the dialog instructs EViews to bring any listed series or alpha objects into the workfile as links to the data in the database. When you open an existing workfile containing database links, EViews will prompt you for whether you wish to refresh the data series. If you click on No, EViews will retain the existing data in the link, otherwise the data will be re-imported from the database when you load the workfile. You may also update existing links manually by selecting Object/Manage Links & Formulae... in the workfile window, specifying the objects to update, and clicking on the associated Refresh button.
When you click on OK, EViews will fetch all the objects. If an object which is being fetched is already contained in the workfile, a dialog will appear asking whether to replace the object or not. Click on Yes to replace the object in the workfile or No to leave the object in the workfile unchanged.
Because a workfile has a fixed frequency and range, fetching a series into a workfile may cause the data in the series to be modified to match the frequency and range of the workfile (see “Frequency Conversion”). Be aware that loading a series into a workfile then saving it back into the database can cause truncation and frequency conversion of the series stored in the database.
Object/Update selected from DB… from the workfile toolbar is the same as Fetch except that there is no overwrite warning message. If the object in the database is the same type as the one in the workfile, it is automatically overwritten. If it is of a different type, the fetch does not proceed. Update is also available from the Object button in individual object windows.
Database Export
You can also move data into a workfile from the database window. From an open database window, select the objects you would like to copy using the mouse, then click on the button marked Export in the toolbar at the top of the database window. The Database Export dialog will appear on the screen:
When you click on the down arrow on the right of the field labeled Workfile, a list of all workfiles that are currently open will appear from which you may choose the workfile into which you would like to copy the objects. In addition, you may use the Page drop down menu to select an existing page in the selected workfile, or to create a new page. Clicking on the button marked OK will copy the selected objects to specified page of the selected workfile.
There is an extra option in the list of open workfiles for specifying a new workfile as your copy destination. If you select New Workfile, EViews will create a new workfile containing the objects you have selected. After you click on OK, a second dialog will appear in which you can set the frequency and range of the workfile to be created. The default frequency is set to the lowest frequency of any of the objects selected, and the default range is set to cover all the data points contained in the objects. Clicking on OK will open a new workfile window and copy the selected objects into it, performing frequency conversion where necessary.
Lastly, you may export your series or alpha objects to the workfile as database links. When you reopen your workfile containing database links, EViews will prompt you for whether you wish to refresh the data series from the database.
Previewing Objects in the Database
To preview one or more objects in the database, select the object or objects and, if necessary, open the preview window. The preview window will display a preview of the contents of the first selected object.
See “Previewing Objects” for details.
Copying Objects
In addition to the above methods for moving objects, EViews provides general support for the copying of objects between any two EViews container objects (workfiles or databases). You may use these features to move objects between two databases or between two workfiles, to create duplicate copies of objects within a workfile or database, or as an alternative method for store and fetch.
Copy-and-Paste
For copying objects between containers, the procedure is very similar no matter what types of container objects are involved. Before you start, make sure that the windows for both containers are open on the screen. In the container from which you would like to copy the objects, select the objects then click on Edit/Copy in the EViews program menu. Click on the container object into which you would like to paste the objects, then select Edit/Paste or Edit/Paste Special... from the EViews program menu.
Depending on the types of the two containers, you may be presented with one or more dialogs. If, for example, you are performing a copy to or from a database, and click on Edit/Paste, the standard Store or Fetch dialogs will appear as if you had carried out the operations using the toolbar buttons on the workfile window. If you click on Edit/Paste Special..., an alternate dialog will be displayed, allowing you to override the default frequency conversion methods.
If, instead, you are copying between two workfiles, selecting Edit/Paste will simply copy the series using the default frequency conversion if necessary. You will only be prompted with a dialog if there is name collision. Selecting Edit/Paste Special... will display a dialog allowing you to override the default conversion methods.
Drag-and-Drop
An alternative to copy-and-paste is to use drag-and-drop to copy files between containers. If you use the right-mouse button to select the series, dropping them on the new tab is equivalent to copying and then selecting Edit/Paste Special...
Copy Procedure
You may perform similar operations using the object copy procedure. From the main menu select Object/Copy (this may appear as Object/Copy selected…). The Object Copy dialog will be displayed.
The Source field specifies the object or objects you would like to copy, the Destination field specifies where you would like to copy them and what names they should be given.
The Source field should be filled in with an expression of the form:
source_db::source_pattern
where source_db:: is optional, and indicates which database the objects should be copied from (if no database name is supplied, the source is taken to be the default workfile), and source_pattern is either a simple object name or a name pattern. A name pattern may include the wildcard characters “?” which matches any single character, and “*” which matches zero or more characters.
The Destination field should be filled in with an expression of the form:
dest_db::dest_name
where dest_db:: is again optional, and indicates which database the objects should be copied to (if no database name is supplied, the destination is taken to be the default workfile), and dest_name, which is also optional, is the name to be given to the new copy of the object. If no name is given, the object will be copied with its existing name. If a pattern was used when specifying the source, a pattern must also be used when specifying the destination (see “Source and Destination Patterns”).
For example, to copy an object from the database DB1 to the database DB2, keeping the existing name, you would fill in the dialog:
source: db1::object_name
destination: db2::
where OBJECT_NAME is the original name as displayed by EViews.
To copy all the objects in the database DB1 beginning with the letter X into the current workfile, changing the names so that they begin with Y, you would fill in the dialog
source: db1::x*
destination: y*
To make a duplicate copy of the object named ABC in the database DB1, giving it the new name XYZ, you would fill in the dialog:
source: db1::abc
destination: db1::xyz
Renaming Objects in the Database
You may rename an object in the database by selecting the object in an open database window, then clicking on the button marked Rename in the database window toolbar. A dialog will come up in which you can modify the existing name or type in a new name. You can rename several objects at the same time using wildcard patterns and the rename command.
Deleting Objects From the Database
To delete objects from the database, select the objects in an open database window, then click on the button marked Delete on the database window toolbar. You may delete several objects at the same time using wildcard patterns. There is also a delete command. See delete for details.
Store, Fetch, and Copy of Group Objects
A group object in EViews is essentially a list of series names that form the group. The data of each series are contained in the series object, not in the group object. When you do a store, fetch, or copy operation on a group object, an issue arises as to whether you want to do the operation on each of the series or to the group definition list.
Storing a Group Object
When you store a group object to a database, there are four available options:
Store the group definition and the series as separate objects: stores the group object (only its definition information) and each of its series as separate objects in the database. If any of the series already exist in the database, EViews will ask whether to overwrite the existing series if in interactive mode, and will error if in batch mode.
Store the group definition and the series as one object: stores each series within the group object. A group object that contains series data will have an icon G+ in the database directory window. A group object with only its definition information will have the usual icon G. If you use this option, you can store two different series with the same name (with one of the series as member of a group).
Store only the series (as separate objects): only stores each series as separate objects in the database. If you want to store a long list of series into a database, you can create a temporary group object that contains those series and issue the store command only once.
Store only the group definition: stores only the group definition information; none of the series data are stored in the database. This option is useful if you want to update the member data from the database but want to keep the group information (e.g. the dated data table settings) in the group.
By default, EViews will display a dialog asking you to select a group store option every time you store a group object. You can, however, instruct EViews to suppress the dialog and use the global option setting. Simply click on Options/Database Storage Defaults... in the main EViews menu to bring up a dialog that allows you both to set the global storage options, and to suppress the group store option dialog.
Fetching a Group Object
When you fetch a group object to a database, there are three options available:
Fetch both group definition and the actual series: fetches both group definition and its series as separate objects. If any of the series defined in the group is not found in the database, the corresponding series will be created in the workfile filled with NAs. If any of the series already exist in the workfile, EViews will ask whether to overwrite the existing series if in interactive mode, and will error if in batch mode.
Fetch only the series in the group: only fetches each series defined in the group. If the series exists both within the group object (with a G+ icon) and as a separate series object in the database, the series within the group object will be fetched.
Fetch only the group definition: fetches only the group definition (but not the series data). If any of the series defined in the group does not exist in the workfile, EViews will create the corresponding series filled with NAs.
You can click on Options/Database Default Storage Options... in the main menu to bring up a dialog that allows you both to set the global fetch options, and to suppress the fetch option dialog.
Copying Group Objects between Workfiles and Databases
You can also copy groups between different containers. The options that are available will differ depending on the type of source and destination container:
Copy from workfile to database: same options as the store operation.
Copy from database to workfile: same options as the fetch operation.
Copy from workfile to workfile: both the group definition and series will be copied.
Copy from database to database. If the group object contains only the group definition (with a G icon), only the group definition will be copied. If the group object also contains its series data (with a G+ icon), then the group will be copied containing the series data and the copied group will also appear with a G+ icon.