Fundamental Eviews
Fundamental Eviews
DATAR ISI
DAFTAR TABEL
DAFTAR GAMBARA
Pendahuluan
"EViews Fundamentals" memperkenalkan dasar-dasar penggunaan EViews. Selain
diskusi tentang operasi dasar Windows, juga dijelaskan cara menggunakan EViews
disertai data. Bagian berikut mendokumentasikan dasar-dasar penggunanaan
EViews:
“Introduction” describes the basics of installing EViews and offers basic
information to get you started (including tips on places to look for help).
“A Demonstration” guides you through a typical EViews session, introducing you
to the basics of working with EViews.
“Work file Basics” describes working with work files (the containers for your data
in EViews).
“Object Basics” provides an overview of EViews objects, which are the building
blocks for all analysis in EViews.
“Basic Data Handling” and “Working with Data” provide background on the basics
of working with numeric data. We describe methods of getting your data into
EViews, manipulating and managing your data held in series and group objects,
and exporting your data into spreadsheets, text files and other Windows
applications.
We recommend that you browse through most of the material in the above sections
before beginning serious work with EViews.
The remaining material is somewhat more advanced and may be ignored until needed:
• “Working with Data (Advanced),” “Series Links,” and “Advanced Work files”
describe advanced tools for working with numeric data, and tools for working with
different kinds of data (alphanumeric and date series, irregular and panel work
files).
• “EViews Databases” describes the EViews database features and advanced data
handling features.
This material is relevant only if you wish to work with the advanced tools.
I. A Demonstration
In this section, we provide a demonstration of some basic features of EViews. The
demonstration is meant to be a brief introduction to EViews; not a comprehensive
description of the program. A full description of the program begins in “Object Basics”.
This demo takes you through the following steps:
• getting data into EViews from an Excel spreadsheet
• examining your data and performing simple statistical analyses
• using regression analysis to model and forecast a statistical relationship
• performing specification and hypothesis testing
• plotting results
Getting Data into EViews
The first step in most projects will be to read your data into an EViews workfile. EViews
provides sophisticated tools for reading from a variety of common data formats,
making it extremely easy to get started.
Before we describe the process of reading a foreign data file, note that the data for
this demonstration have been included in both Excel spreadsheet and EViews workfile
formats in your EViews installation directory (“.\Example Files\EV8 Manual
Data\Chapter 2 - A Demonstration”).
If you wish to skip the discussion of opening foreign files, going directly to the analysis
part of the demonstration, you may load the EViews workfile by selecting
File/Open/EViews Workfile… and opening “Demo.WF1”, or by navigating to the
directory and drag-and-dropping “Demo.WF1” onto your open EViews application
window or icon.
The easiest way to read the data from Excel file “Demo.XLS” is to drag-and-drop the
file into an open EViews application window. You may also drag-and-drop the file onto
the EViews icon. In the latter case, Windows will first start the EViews application and
will then open the demonstration Excel workfile.
Alternately, you may use the File/Open/Foreign Data as Workfile... dialog, selecting
Files of type Excel and selecting the desired file.
When EViews opens “Demo.XLS”, it determines that the file is in Excel file format,
analyzes the contents, and opens the Excel Read wizard.
The first page of the wizard includes a preview of the data found in the spreadsheet.
In most cases, you need not worry about any of the options on this page. In more
complicated cases, you may use the options on this page to provide a custom range
of cells to read, or to select a different sheet in the workbook.
The second page of the wizard contains various options for reading the Excel data.
These options are set at the most likely choices given the EViews analysis of the
contents of your workbook. In most cases, you should simply click on Finish to accept
the default settings. In other cases where the preview window does not correctly
display the desired data, you may click on Next and adjust the options that appear on
the second page of the wizard. In our example, the data appear to be correct, so we
simply click on Finish to accept the default settings.
When you accept the settings, EViews automatically creates a workfile that is sized to
hold the data, and imports the series into the workfile. The workfile ranges from 1952
quarter 1 to 1996 quarter 4, and contains five series (GDP, M1, OBS, PR, and RS)
that you have read from the Excel file. There are also two objects, the coefficient vector
C and the series RESID, that are found in all EViews workfiles.
Select all of the series, right-click, and select Open/as Group. EViews will open the
selected series in spreadsheet view.
You can use the scroll bars and scroll arrows on the right side of the window to view
and verify the reminder of the data.
You may wish to click on the Name button in the group toolbar to provide a name for
your UNTITLED group. Enter the name ORIGINAL, and click on OK to accept the
name.
Once you are satisfied that the data are correct, you should save the workfile by
clicking on the Save button in the workfile window. A saved dialog will open, prompting
you for a workfile name and location. You should enter “Demo2.WF1”, and then click
OK. A second dialog may be displayed prompting you to set storage options. Click OK
to accept the defaults. EViews will save the workfile in the specified directory with the
name “Demo2.WF1”. A saved workfile may be opened later by selecting
File/Open/Workfile.… from the main menu.
Examining the Data
Now that you have your data in an EViews workfile, you may use basic EViews tools
to examine the data in your series and groups in a variety of ways.
First, we examine the characteristics of individual series. To see the contents of the
M1 series, simply double click on the M1 icon in the workfile window, or select
Quick/Show… in the main menu, enter m1, and click on OK.
EViews will open the M1 series object and will display the default spreadsheet view of
the series. Note the description of the contents of the series (“Series: M1”) in the upper
leftmost corner of the series window toolbar, indicating that you are working with the
M1 series.
You will use the entries in the View and Proc menus to examine various characteristics
of the series. Simply click on the buttons on the toolbar to access these menu entries,
or equivalently, select View or Proc from the main menu.
To compute, for example, a table of basic descriptive statistics for M1, simply click on
the View button, then select Descriptive Statistics & Tests/Stats Table. EViews will
compute descriptive statistics for M1 and change the series view to display a table of
results.
Similarly, to examine a line graph of the series, simply select View/Graph... to bring
up the Graph Options dialog, and select Line & Symbol from the list of graph types on
the left-hand side. EViews will change the M1 series window to display a line graph of
the data in the M1 series.
Note the presence of the slider bar in the bottom of the window which you may drag
to show a sub-sample of the observations.
At this point, you may wish to explore the contents of the View and Proc menus in the
M1 series window to see the various tools for examining and working with series data.
You may always return to the spreadsheet view of your series by selecting
View/Spreadsheet from the toolbar or main menu.
Since our ultimate goal is to perform regression analysis with our data expressed in
natural logarithms, we may instead wish to work with the log of M1. Fortunately,
EViews allows you to work with expressions involving series as easily as you work
with the series themselves. To open a series containing this expression, select
Quick/Show… from the main menu, enter the text for the expression, log(m1), and
click OK. EViews will open a series window for containing LOG(M1). Note that the
titlebar for the series shows that we are working with the desired expression.
You may work with this auto-series in exactly the same way you worked with M1
above. For example, clicking on View in the series toolbar and selecting Descriptive
Statistics & Tests/Histogram and Stats displays a view containing a histogram and
descriptive statistics for LOG(M1):
Suppose that you wish to examine multiple series or series expressions. To do so,
you will need to construct a group object that contains the series of interest.
Earlier, you worked with an EViews created group object containing all of the series
read from your Excel file. Here, we will construct a group object containing expressions
involving a subset of those series. We wish to create a group object containing the
logarithms of the series M1 and GDP, the level of RS, and the first difference of the
logarithm of the series PR. Simply select Quick/Show... from the main EViews menu,
and enter the list of expressions and series names:
log(m1) log(gdp) rs dlog(pr)
Click on OK to accept the input. EViews will open a group window containing a
spreadsheet view of the series and expressions of interest.
As with the series object, you will use the View and Proc menus of the group to
examine various characteristics of the group of series. Simply click on the buttons on
the toolbar to access these menu entries or select View or Proc from the main menu
to call up the relevant entries. Note that the entries for a group object will differ from
those for a series object since the kinds of operations you may perform with multiple
series differ from the types of operations available when working with a single series.
For example, you may select View/Graph... from the group object toolbar, and then
select Line & Symbol from the list on the left side of the dialog to display a single graph
containing line plots of each of the series in the group:
Alternately, you may select View/Graph... and choose Multiple graphs from the
Multiple series drop-down on the right side of the dialog to display the same
information, but with each series expression plotted in an individual graph:
Likewise, you may select View/Descriptive Stats/Individual Samples to display a table
of descriptive statistics computed for each of the series in the group:
Note that the number of observations used for computing descriptive statistics for
DLOG(PR) is one less than the number used to compute the statistics for the other
expressions. By electing to compute our statistics using “Individual Samples”, we
informed EViews that we wished to use the series specific samples in each
computation, so that the loss of an observation in DLOG(PR) to differencing should
not affect the samples used in calculations for the remaining expressions.
We may instead choose to use “Common Samples” so that observations are only used
if the data are available for all of the series in the group. Click on View/Covariance
Analysis... and select only the Correlation checkbox to display the correlation matrix
of the four series for the 179 common observations:
Once again, we suggest that you may wish to explore the contents of the View and
Proc menus for this group to see the various tools for examining and working with sets
of series You can always return to the spreadsheet view of the group by selecting
View/Spreadsheet.
Estimating a Regression Model
We now estimate a regression model for M1 using data over the period from 1952Q1–
1992Q4 and use this estimated regression to construct forecasts over the period
1993Q1–2003Q4. The model specification is given by:
(2.1)
where log(M1) is the logarithm of the money supply, log(GDP) is the log of income,
RS is the short term interest rate, and ∆log(PR) is the log first difference of the price
level (the approximate rate of inflation).
To estimate the model, we will create an equation object. Select Quick from the main
menu and choose Estimate Equation… to open the estimation dialog. Enter the
following equation specification:
Here we list the expression for the dependent variable, followed by the expressions
for each of the regressors, separated by spaces. The built-in series name C stands
for the constant in the regression.
The dialog is initialized to estimate the equation using the LS - Least Squares method
for the sample 1952Q1 1996Q4. You should change text in the Sample edit box to
“1952Q1 1992Q4” or equivalently “1952 1992” to estimate the equation for the
subsample of observations.
Click OK to estimate the equation using least squares and to display the regression
results:
Note that the equation is estimated from 1952Q2 to 1992Q4 since one observation is
dropped from the beginning of the estimation sample to account for the DLOG
difference term. The estimated coefficients are statistically significant, with t-statistic
values well in excess of 2. The overall regression fit, as measured by the value,
indicates a very tight fit. You can select View/Actual, Fitted, Residual/Actual, Fitted,
Residual Graph in the equation toolbar to display a graph of the actual and fitted values
for the dependent variable, along with the residuals:
Specification and Hypothesis Tests
We can use the estimated equation to perform hypothesis tests on the coefficients of
the model. For example, to test the hypothesis that the coefficient on the price term is
equal to 2, we will perform a Wald test. First, determine the coefficient of interest by
selecting View/Representations from the equation toolbar:
Note that the coefficients are assigned in the order that the variables appear in the
specification so that the coefficient for the PR term is labeled C(4). To test the
restriction on C(4) you should select View/Coefficient Diagnostics/Wald Test–
Coefficient Restrictions…, and enter the restriction “c(4)=2”. EViews will report the
results of the Wald test:
The low probability values indicate that the null hypothesis that C(4)=2 is strongly
rejected.
We should, however, be somewhat cautious of accepting this result without additional
analysis. The low value of the Durbin-Watson statistic reported above is indicative of
the presence of serial correlation in the residuals of the estimated equation. If
uncorrected, serial correlation in the residuals will lead to incorrect estimates of the
standard errors, and invalid statistical inference for the coefficients of the equation.
The Durbin-Watson statistic can be difficult to interpret. To perform a more general
Breusch-Godfrey test for serial correlation in the residuals, select View/Residual
Diagnostics/Serial Correlation LM Test… from the equation toolbar, and specify an
order of serial correlation to test against. Entering “1” yields a test against first-order
serial correlation:
The top part of the output presents the test statistics and associated probability values.
The test regression used to carry out the test is reported below the statistics.
The statistic labeled “Obs*R-squared” is the LM test statistic for the null hypothesis of
no serial correlation. The (effectively) zero probability value strongly indicates the
presence of serial correlation in the residuals.
Modifying the Equation
The test results suggest that we need to modify our original specification to take
account of the serial correlation.
One approach is to include lags of the independent variables. To add variables to the
existing equation, click on the Estimate button in the equation toolbar and edit the
specification to include lags for each of the original explanatory variables:
log(m1) c log(gdp) rs dlog(pr) log(m1(-1)) log(gdp(-1)) rs(-1) dlog(pr(-1))
Note that lags are specified by including a negative number, enclosed in parentheses,
following the series name. Click on OK to estimate the new specification and to display
the results:
Note that EViews has automatically adjusted the estimation sample to accommodate
the additional lagged variables. We will save this equation in the workfile for later use.
Press the Name button in the toolbar and name the equation EQLAGS.
(2.2)
Click OK to accept the new specification. EViews will estimate the equation and will
report the estimation results, including the estimated first-order autoregressive
coefficient of the error term:
The fit of the AR(1) model is roughly comparable to the lag model, but its somewhat
higher values for both the Akaike and the Schwarz information criteria indicate that the
previous lag model may be preferred. Accordingly, we will work with the lag model in
EQLAGS for the remainder of the demonstration.
Forecasting from an Estimated Equation
We have been working with a subset of our data, so that we may compare forecasts
based upon this model with the actual data for the post-estimation sample 1993Q1–
1996Q4.
Click on the Forecast button in the EQLAGS equation toolbar to open the forecast
dialog:
We set the forecast sample to 1993Q1–1996Q4 and provide names for both the
forecasts and forecast standard errors so both will be saved as series in the workfile.
The forecasted values will be saved in M1_F and the forecast standard errors will be
saved in M1_SE.
Note also that we have elected to forecast the log of M1, not the level, and that we
request both graphical and forecast evaluation output. The Dynamic option constructs
the forecast for the sample period using only information available at the beginning of
1993Q1. When you click OK, EViews displays both a graph of the forecasts, and
statistics evaluating the quality of the fit to the actual data:
Alternately, we may also choose to examine forecasts of the level of M1. Click on the
Forecast button in the EQLAGS toolbar to open the forecast dialog, and select M1
under the Series to forecast option. Enter a new name to hold the forecasts and
standard errors, say M1LEVEL_F and M1LEVEL_SE, and click OK.
EViews will present a graph of the forecast of the level of M1, along with the
asymmetric confidence intervals for this forecast:
The series that the forecast procedure generates are ordinary EViews series that you
may work with in the usual ways. For example, we may use the forecasted series for
LOG(M1) and the standard errors of the forecast to plot actuals against forecasted
values with (approximate) 95% confidence intervals for the forecasts.
We will first create a new group object containing these values. Select Quick/Show...
from the main menu, and enter the expressions:
m1_f+2*m1_se m1_f-2*m1_se log(m1)
to create a group containing the confidence intervals for the forecast of LOG(M1) and
the actual values of LOG(M1):
There are three expressions in the dialog. The first two represent the upper and lower
bounds of the (approximate) 95% forecast interval as computed by evaluating the
values of the point forecasts plus and minus two times the standard errors. The last
expression represents the actual values of the dependent variable.
When you click OK, EViews opens an untitled group window containing a spreadsheet
view of the data. Before plotting the data, we will change the sample of observations
so that we only plot data for the forecast sample. Select Quick/Sample… or click on
the Sample button in the group toolbar, and change the sample to include only the
forecast period:
To plot the data for the forecast period, select View/Graph... from the group window
and choose Line & Symbol from the list on the left of the Graph Options dialog:
The actual values of log(M1) are within the forecast interval for most of the forecast
period, but fall below the lower bound of the 95% confidence interval beginning in
1996:1.
(Note that the slider bar at the bottom of the graph indicates that we are viewing only
a subset of the workfile range).
For an alternate view of these data, you can select View/Graph... and Error Bar from
the list in the dialog, which displays the graph as follows:
This graph shows clearly that the forecasts of LOG(M1) over-predict the actual values
in the last four quarters of the forecast period.
Additional Testing
Note that the above specification has been selected for illustration purposes only.
Indeed, performing various specification tests on EQLAGS suggests that there may
be a number of problems with the existing specification.
For one, there is quite a bit of serial correlation remaining even after estimating the
lag specification. A test of serial correlation in the EQLAGS equation (by selecting
View/Residual Diagnostics/Serial Correlation LM Test…, and entering “1” for the
number of lags) rejects the null hypothesis of no serial correlation in the reformulated
equation. The top portion of the output is:
EViews performs the ADF test statistic with the number of lagged difference terms in
the test equation (here, four) determined by automatic selection. The ADF test statistic
value has a probability value of 0.9911, providing little evidence that we may reject the
null hypothesis of a unit root.
If a unit root were present in our data, we may wish to adopt more sophisticated
statistical models. These techniques are discussed in “Time Series Regression”,
“Vector Autoregression and Error Correction Models” which deal with basic time
series, cointegrating regression models, and vector error correction specifications,
respectively).
II. Workfile Basics
Managing the variety of tasks associated with your work can be a complex and time-
consuming process. Fortunately, EViews’ innovative design takes much of the effort
out of organizing your work, allowing you to concentrate on the substance of your
project. EViews provides sophisticated features that allow you to work with various
types of data in an intuitive and convenient fashion.
Before describing these features, we begin by outlining the basic concepts underlying
the EViews approach to working with datasets using workfiles, and describing simple
methods to get you started on creating and working with workfiles in EViews.
What is a Workfile?
At a basic level, a workfile is simply a container for EViews objects (see “Object
Basics”). Most of your work in EViews will involve objects that are contained in a
workfile, so your first step in any project will be to create a new workfile or to load an
existing workfile into memory.
Every workfile contains one or more workfile pages, each with its own objects. A
workfile page may be thought of as a subworkfile or subdirectory that allows you to
organize the data within the workfile.
For most purposes, you may treat a workfile page as though it were a workfile (just as
a subdirectory is also a directory) since there is often no practical distinction between
the two. Indeed, in the most common setting where a workfile contains only a single
page, the two are completely synonymous. Where there is no possibility of confusion,
we will use the terms “workfile” and “workfile page” interchangeably.
Workfiles and Datasets
While workfiles and workfile pages are designed to hold a variety of EViews
objects, such as equations, graphs, and matrices, their primary purpose is to hold the
contents of datasets. A dataset is defined here as a data rectangle, consisting of a set
of observations on one or more variables—for example, a time series of observations
on the variables GDP, investment, and interest rates, or perhaps a random sample of
observations containing individual incomes and tax liabilities.
Key to the notion of a dataset is the idea that each observation in the dataset
has a unique identifier, or ID. Identifiers usually contain important information about
the observation, such as a date, a name, or perhaps an identifying code. For example,
annual time series data typically use year identifiers (“1990”, “1991”, ...), while cross-
sectional state data generally use state names or abbreviations (“AL”, “AK”, ..., “WY”).
More complicated identifiers are associated with longitudinal data, where one typically
uses both an individual ID and a date ID to identify each observation.
Observation IDs are often, but not always, included as a part of the dataset.
Annual datasets, for example, usually include a variable containing the year
associated with each observation. Similarly, large cross-sectional survey data typically
include an interview number used to identify individuals.
In other cases, observation IDs are not provided in the dataset, but external
information is available. You may know, for example, that the 21 otherwise unidentified
observations in a dataset are for consecutive years beginning in 1990 and continuing
to 2010.
In the rare case were there is no additional identifying information, one may
simply use a set of default integer identifiers that enumerate the observations in the
dataset (“1”, “2”, “3”, ...).
Since the primary purpose of every workfile page is to hold the contents of a
single dataset, each page must contain information about observation identifiers.
Once identifier information is provided, the workfile page provides context for working
with observations in the associated dataset, allowing you to use dates, handle lags,
or work with longitudinal data structures.
Creating a Workfile
There are several ways to create and set up a new workfile. The first task you
will face in setting up a workfile (or workfile page) is to specify the structure of your
workfile. We focus here on three distinct approaches:
First, you may simply describe the structure of your workfile (“Creating a Workfile
by Describing its Structure”). EViews will create a new workfile for you to enter or
import your data).
Describing the workfile is the simplest method, requiring only that you answer a
few simple questions—it works best when the identifiers follow a simple pattern that
is easily described (for example, “annual data from 1950 to 2000” or “quarterly data
from 1970Q1 to 2002Q4”). This approach must be employed if you plan to enter data
into EViews by typing or copy-and-pasting data.
In the second approach, you simply open and read data from a foreign data
source (“Creating a Workfile by Reading from a Foreign Data Source”). EViews will
analyze the data source, create a workfile, and then automatically import your data.
The final approach, which should be reserved for more complex settings,
involves two distinct steps. In the first, you create a new workfile using one of the first
two approaches (by describing the structure of the workfile, or by opening and reading
from a foreign data source). Next, you will structure the workfile, by instructing EViews
to construct unique identifiers, in some cases using values of variables contained in
the dataset.
We begin by describing the first two methods. The third approach, involving the
more complicated task of structuring a workfile, will be taken up in “Structuring a
Workfile”.
Creating a Workfile by Describing its Structure
To describe the structure of your workfile, you will need to provide EViews with
external information about your observations and their associated identifiers. For
example, you might tell EViews that your dataset consists of a time series of
observations for each quarter from 1990Q1 to 2003Q4, or that you have information
for every day from the beginning of 1997 to the end of 2001. At the very least, you
might indicate that you have a dataset with 500 observations and no additional
identifier information.
To create a new workfile, select File/New/Workfile... from the main menu to open the
Workfile Create dialog.
On the left side of the dialog is a dropdown menu for describing the underlying
structure of your dataset. You will choose between the Dated - regular frequency, the
Unstructured, and the Balanced Panel settings. Generally speaking, you should use
Dated - regular frequency if you have a simple time series dataset, for a simple panel
dataset you should use Balanced Panel, and in all other cases, you should select
Unstructured. Additional detail to aid you in making a selection is provided in the
description of each category.
Describing a Dated Regular Frequency Workfile
When you select Dated - regular frequency, EViews will prompt you to select a
frequency for your data. You may choose between the standard EViews supported
date frequencies (Multi-year, Annual, Semi-annual, Quarterly, Monthly, Bimonthly,
Fortnight, Ten-day, Weekly, Daily - 5 day week, Daily - 7 day week, Daily - custom
week, Intraday), and a special frequency (Integer date) which is a generalization of a
simple enumeration.
In selecting a frequency, you set intervals between observations in your data (whether
they are annual, semi-annual, quarterly, monthly, weekly, etc.), which allows EViews
to use all available calendar information to organize and manage your data. For
example, when moving between daily and weekly or annual data, EViews knows that
some years contain days in each of 53 weeks, and that some years have 366 days,
and will use this information when working with your data.
As the name suggests, regular frequency data arrive at regular intervals, defined by
the specified frequency (e.g., monthly). In contrast, irregular frequency data do not
arrive in regular intervals. An important example of irregular data is found in stock and
bond prices where the presence of holidays and other market closures ensures that
data are observed only irregularly, and not in a regular 5-day daily frequency. Standard
macroeconomic data such as quarterly GDP or monthly housing starts are examples
of regular data.
EViews also prompts you to enter a Start date and End date for your workfile. For
Daily - custom week or Intraday, you will also need to enter Day and/or Time
information as described below. When you click on OK, EViews will create a regular
frequency workfile with the specified number of observations and the associated
identifiers.
Suppose, for example, that you wish to create a quarterly workfile that begins with the
first quarter of 1970 and ends in the last quarter of 2020.
• First, select Dated - regular frequency for the workfile structure, and then choose the
Quarterly frequency.
• Next, enter the Start date and End date. There are a number of ways to fill in the
dates. EViews will use the largest set of observations consistent with those dates,
so if you enter “1970” and “2020”, your quarterly workfile will begin in the first quarter
of 1970, and end in the last quarter of 2020. Entering the date pair “Mar 1970” and
“Nov 2020”, or the start-end pair “3/2/1970” and “11/15/2020” would have generated
a workfile with the same structure, since the implicit start and end quarters are the
same in all three cases.
This latter example illustrates a fundamental principle regarding the use of date
information in EViews. Once you specify a date frequency for a workfile, EViews will
use all available calendar information when interpreting date information. For example,
given a quarterly frequency workfile, EViews knows that the date “3/2/1990” is in the
first quarter of 1990 (see “Dates” for details).
For some choices of frequency, you will be prompted for additional information. If, for
example, you select the Daily - custom week frequency, the dialog will prompt you to
provide a range for the days of the week in your custom week. You should use the
Intraweek/Intraday range dropdown menus to define a the start and end of the week.
Here, we indicate that we want to define a custom 4-day (Monday-Thursday) week.
If you choose the Intraday frequency you will be prompted to provide additional
information about the structure of your observed days. You must provide information
about the frequency of observations within the day, the days of the week for which you
observe data, and the time, and the time range of observations within a day.
The intraday settings are best illustrated through a simple example. To create an
hourly workfile that begins at 8AM Monday and ends at 5PM Friday for every day in
2005, you should also specify the Day and Time parameters.
• Select Dated - regular frequency for the workfile structure, and then choose the
Intraday frequency. Select Hour from the dropdown that appears.
• Enter the Start date and End date. In this case, this will be 2005 for both fields.
• After selecting an Intraday frequency, the Intraweek/Intraday range options were
enabled at the bottom of the dialog. Select 1-Mon through 5-Fri from the Days
dropdowns and 8:00:00 through 17:00:00 from the Time dropdowns.
Note that the workfile created will have ten observations per day, the first at 8
a.m. and the last at 5 p.m. Though you may have intended to create a workfile to
record nine hours of data, specifying an end time of 17:00:00 defines the period from
5 p.m. to 6 p.m., adding an extra hour to the day specification. This may be desirable
for recording discrete measurements on the hour from 8 a.m. to 5 p.m., but if you wish
to measure the hours as intervals (from 8 a.m. to 9 a.m., 9 a.m. to 10 a.m., ..., and 4
p.m. to 5 p.m.), with one observation for each interval, you should specify an end time
of 16:00:00, or 4 p.m. An end time of 16:00:00 defines the last interval as 4 p.m. to 5
p.m (see “Specifying Start and End Times” for a thorough discussion of how start and
end times are defined).
Lastly, you may optionally provide a name to be given to your workfile and a
name to be given to the workfile page. After creating a workfile, you can see EViews’
interpretation of your workfile specification by looking at the Workfile structure dialog.
Select Proc/Structure/Resize Current Page... or click on the Range area at the top of
the new workfile to bring up the Workfile structure dialog (see “Applying a Structure to
a Workfile” for detailed discussion of structuring a workfile and the settings in this
dialog).
For the previous example, you may take note of two things in the dialog. First,
the Start date is displayed as “1/03/2005 08:00”, which corresponds to 8 a.m. this is
the first Monday in 2005. Similarly, the End date is “12/30/2005 17:00”, the last Friday
in 2005. Second, notice that the time in the End date field is different from the time
displayed in the Time end field. This illustrates that because the End date is specified
in hours, an end time of 17:00 defines the period from 5 p.m. to 6 p.m. Alternately, the
Time field denotes the last second that is part of the specification, 17:59:59.
Describing an Unstructured Workfile
Unstructured data are simply data which use the default integer identifiers. You should
choose the Unstructured type if your data are not a Dated - regular frequency or
Balanced Panel (i.e., you wish to create an undated workfile that uses the default
identifiers or you will eventually define an advanced structure your data).
When you select this structure in the dropdown menu, the remainder of the dialog will
change, displaying a single field prompting you for the number of observations. Enter
the number of observations, and click on OK to proceed. In the example depicted here,
EViews will create a 500 observation workfile containing integer identifiers ranging
from 1 to 500.
In many cases, the integer identifiers will be sufficient for you to work with your data.
In more complicated settings, you may wish to further refine your identifiers. We
describe this process in “Applying a Structure to a Workfile”.
Describing a Balanced Panel Workfile
The Balanced Panel entry provides a simple method of describing a regular frequency
panel data structure. Panel data is the term that we use to refer to data containing
observations with both a group (cross-section) and time (within-group) identifiers.
This entry may be used when you wish to create a balanced structure in which every
cross-section follows the same regular frequency with the same date observations.
Only the barest outlines of the procedure are provided here since a proper discussion
requires a full description of panel data and the creation of the advanced workfile
structures. Panel data and structured workfiles are discussed at length in “Structuring
a Workfile”.
To create a balanced panel, select Balanced Panel in the dropdown menu, specify the
desired Frequency, and enter the Start date and End date, and Number of cross
sections. You may optionally name the workfile and the workfile page. Click on OK.
EViews will create a balanced panel workfile of the given frequency, using the
specified start and end dates and number of cross-sections.
Here, EViews creates a 200 cross-section, regular frequency, quarterly panel workfile
with observations beginning in 1970Q1 and ending in 2020Q4.
Unbalanced panel workfiles or workfiles involving more complex panel structures
should be created by first defining an unstructured workfile, and then applying a panel
workfile structure.
Creating a Workfile by Reading from a Foreign Data Source
A second method of creating an EViews workfile is to open a foreign (non-EViews
format) data source and to read the data into an new EViews workfile.
One way to read foreign data into a new workfile is to copy the foreign data source to
the Windows clipboard, right click on the gray area in your EViews window, and select
Paste as new Workfile. EViews will automatically create a new workfile containing the
contents of the clipboard. Such an approach, while convenient, is only practical for
small amounts of data.
Alternately, you may open a foreign data source as an EViews workfile. There are two
ways to proceed. First, you may select File-Import/Import from File... to bring up the
standard file Open dialog. Clicking on the Files of type dropdown menu brings up a
list of the file types that EViews currently supports for opening a workfile. Select a file
type to narrow the list of files in the dialog, then choose the file you wish to open. Note
that the file can be web-based, in which case you may provide a URL for a file or
HTML page, or it can be located on your major provider cloud drive (“Cloud Drive
Support”).
EViews also offers drag-and-drop support for the file open operation. Simply select
the file you wish to open in Windows, then drag-and-drop the file on the gray area in
your EViews window.
Whichever your approach, EViews will open the specified foreign data as an EViews
workfile.
If you select a time series database file (e.g., Aremos TSD, GiveWin/Pc-Give, Rats
4.x, Rats Portable, TSP Portable), EViews will create a new, regular frequency workfile
containing the contents of the entire file. If there are mixed frequencies in the
database, EViews will select the lowest frequency, and convert all of the series to that
frequency using the default conversion settings (we emphasize here that all of these
database formats may also be opened as databases by selecting
File/Open/Database... and filling out the dialogs, allowing for additional control over
the series to be read, the new workfile frequency, and any frequency conversion).
If you choose one of the remaining source types, EViews will create a new
unstructured workfile. First, EViews will open a series of dialogs prompting you to
describe and select data to be read. The data will be read into the new workfile, which
will be resized to fit. If possible, EViews will attempt to structure the workfile using
information in the file. If this is not possible but you still wish to apply a specific workfile
structure with these data, you will have to define a structured workfile using the
advanced workfile structure tools (see “Structuring a Workfile”).
The import as workfile interface is available for Microsoft Access files, Gauss Dataset
files, ODBC Dsn files, ODBC Query files, SAS Transport files, native SPSS files (using
the SPSS Input/output .DLL that should be installed on your system), SPSS Portable
files, Stata files, Excel files, raw ASCII or binary files, or ODBC Databases and queries
(using an ODBC driver already present on your system).
For many of these files, you can link the data in the workfile to the original data source,
allowing the EViews workfile to update its data to the data contained in the source file.
At the end of the open process, EViews will ask if the new series objects should be
linked back to the source. Click Yes to mark the new series objects as externally
linked. Linked objects can be refreshed with updated data when the workfile is next
opened, or on demand by right-clicking on the workfile window and selecting Update
from DB… or by clicking on Objects/Manage Links & Formulae... in the main menu to
display the link management dialog.
When you next open your existing workfile containing linked data, EViews will prompt
you to refresh the data, and optionally, to display a comparison of the data before and
after the refresh:
An Illustration
Perhaps the most common form of foreign data files are Excel files, followed by text
files (ASCII). We offer examples of reading Excel, ASCII, and Stata files to illustrate
the basic process of creating a new workfile (or a workfile page) by opening a foreign
source file.
(The wfopen command offers command line support for all of these methods. See
wfopen.)
The easiest way to specify the foreign file to be opened is to drag-and-drop the file
into background area of the main EViews window.
Here we have dragged an Excel file onto the EViews desktop. A plus (“+”) sign will
appear when the file is over an appropriate area. Drop the file and EViews will proceed
with the foreign file open process, first opening the selected file, validating its type,
then displaying a tabbed dialog allowing you to select the specific data that you wish
to read into your new workfile. If you wish to read all of your data using the default
settings, click on OK to proceed. Otherwise you may use each of the tabs to change
the read behavior.
Alternately, you may specify the foreign file using the File-Open/Foreign data as
workfile... dialog. First navigate to the appropriate directory and select the Files of type
entry to match the file you wish to open. In this example, we see that if we select Stata
files (*.dta) the dialog displays a list of Stata files that may be opened.
Double-click on the name to select and open the file, or enter the filename in the dialog
and click on Open to accept the selection. Note that the Open dialog displayed here
is the one for the Windows 8 operating system. The dialog may look different in other
versions of Windows.
The Column headers section of Step 2 allows you to specify the number of header
lines (lines containing information about each column of the data, such as column
names or descriptions, rather than the data itself) contained in the Excel file, and tell
EViews a little bit about what information is stored in the header lines, using the
Header type dropdown box.
If the data in your Excel file has special coding for missing values, you can set the
Text representing NA box to whatever value your data uses.
EViews will fill out the Column info box automatically, based upon your choices in the
Column headers box, and by analyzing the data in your file. If you would like to change
the name, description or data type (Character, Number or Date) of a specific column,
select that column in the preview box at the bottom of the dialog, and then change the
information.
Again, if you would like to transpose your data, you may elect to do so by checking
the Read series by row checkbox at the bottom of the dialog.
Once you have described the file and data, you may click Finish. Alternately, to further
specify details on how you wish to perform the import of data, click Next to open up
Step 3 of the Excel 97-2003 Read dialog.
Some options in this dialog are simplified because we are reading into a new workfile.
As such, we don’t need to worry about how our data fits into the structure of an existing
workfile. For instance, the Import method dropdown in the top-left portion of the dialog
will be set to Create new workfile in this case. In the Import options section, the
Frequency Conversion button will be disabled, as we have no need to define
frequency conversion methods when importing into a new workfile. See “Importing
Data” for information on reading into an existing workfile.
The Import options section offers access to settings for renaming series. Renaming
the series on import allows you to handle illegal input series names, and to avoid name
conflicts with existing series.
The Rename Series button brings up a dialog allowing you to perform multiple series
renaming. Renaming should be done by entering an existing series name followed by
the new series name in pairs. For example, entering
series01 gdp series02 unemp series03 m1
will rename the series SERIES01 to GDP, SERIES02 to UNEMP, and SERIES03 to
M1.
You may use the “*” and “?” wildcards as part of the renaming specification to rename
multiple series at once. For example,
series* gdp*
changes the names of all series with an existing prefix of “SERIES” to “GDP”. In other
words, SERIES01 will become GDP01 and SERIES_USA will become GDP_USA.
The area to the right of the Import options dropdown may be used to define the
structure of the new workfile.
The bottom portion of the dialog consists of a preview display, which shows a sample
of destination observations along with corresponding data from the source file. The
preview will change along with your selected import method specification.
When the source file is first opened, EViews will attempt to identify the frequency and
potentially a date series in the file (i.e. a column of data containing dates). If a source
date series is located, the Basic structure dropdown will be set to Dated - specified by
date series and the source name will be entered in the Date series edit field.
To aid you in visualizing the effect of the Basic structure setting, the left-hand column
of the data preview display updates with changes in the structure to show you the
current date settings.
In most cases, EViews will have correctly identified the date structure so that the
default settings will require no change. Click on the Finish button complete the import
specification and instruct EViews to begin the import procedure.
You may, if desired, override the default EViews date specification settings by
changing the Basic structure dropdown menu, and then using the dialog to specify the
data frequency explicitly.
For example, if you select Dated - regular frequency in the Basic structure dropdown,
the dialog changes to reflect the new settings:
Notice that EViews no longer shows the date series under Basic structure, instead
prompting you to provide a Frequency/date specification using the Frequency
dropdown menu and the Start date edit field. EViews will assume that the source file
has sequential observations of the given frequency beginning in the specified date.
Since we have not yet specified a Start date, the “?”s in the observation preview at the
bottom of the dialog indicate that the observation matching is indeterminate. Once a
start date is specified, the display will be updated to show how the observations will
be imported.
When Dated Panel is selected in the Basic structure dropdown, the import structure
section of the dialog provides different options, prompting you to specify a Cross
section ID series and a Date series.
When you are pleased with the setup shown at the bottom of the dialog, click on the
Finish button.
The final step of the import process involves deciding whether to link the EViews file
back to the original Excel file. EViews will ask if the new series objects should be linked
back to the source. Linked data remembers the specification of its source and can be
updated or refreshed to re-import the data. Click Yes to mark the new series objects
as externally linked. Linked objects can be refreshed with updated data when the
workfile is next opened, or on demand by right-clicking on the workfile window and
selecting Update from DB… or by clicking on Objects/Manage Links & Formulae... in
the main menu to display the link management dialog.
When you next open your existing workfile containing linked data, EViews will prompt
you to refresh the data, and optionally, to display a comparison of the data before and
after the refresh:
Opening an ASCII text file
If you have chosen an ASCII text file, EViews will open Step 1 of the Text Read dialog.
This page lets you specify column and row information for your file. Generally EViews
will analyze your file and fill this data in correctly, so you can just click Finish. If EViews
has not analyzed your data correctly, you can make changes during the four steps of
the Text Read dialog.
If your text file has lines of text at the start of the file that come before the actual
columns of data (such as text explaining what the data is, or where it came from), you
can tell EViews to skip these lines as part of the data read in the Start of data/header
section.
Most text files containing data will have a row of text for each observation, and EViews,
by default, will read in the data assuming this is the case. For more complicated
structures, you should press the Show row options button, which will then display a
set of options that allow you to specify how each row of your file is formatted.
The Column specification box lets you specify how each column of data is separated.
The most common method of separating columns in a text file is through the use of a
delimiter character between each column, such as a comma, space, or tab. A second
form of separation is through fixed width columns, in which each column has the same
number of characters in it for every row. If your data has a fixed width, you should
select Fixed width fields. If your text file uses neither delimiters nor fixed widths, you
should select An explicit format (to be provided).
Step 2 of the Text Read dialog will change depending on the choices you made in the
Column specification box during Step 1. If you chose Delimiter characters between
values, then Step 2 lets you specify information about the delimiters. You can either
choose from one of the preset Standard delimiters, or specify a Custom delimiter. You
can also choose how EViews treats delimiters that are part of text enclosed in quotes
using the Other options section.
If you chose Fixed width fields as your column separator, Step 2 will let you specify
the width of each column. Finally, if you chose An explicit format, then Step 2 lets you
specify the format string.
Steps 3-4 of the Text Read dialog are exactly the same as Steps 2-3 of the Excel Read
dialog, as explained above beginning on (here). Step 3 allows you set information
regarding the data columns of your file, while in Step 4 you can specify the new
workfile structure and rename series.
Opening a Stata file
If you had chosen a Stata file (or other file containing predefined variable information)
to be read, the Table read specification dialog will open, letting you select which
variables to read.
The Select variables tab of the dialog should be used to choose the series data to be
included. The upper list box shows the names of the variables that can be read into
EViews series, along with the variable data type, and if available, a description of the
data. The variables are first listed in the order in which they appear in the file. You may
choose to sort the data by clicking on the header for the column. The display will be
toggled between three states: the original order, sorted (ascending), and sorted
(descending). In the latter two cases, EViews will display a small arrow on the header
column indicating the sort type. Here, the data are sorted by variable name in
ascending order.
When the dialog first opens, all variables are selected for reading. You can change
the current state of any variable by checking or unchecking the corresponding
checkbox. The number of variables selected is displayed at the bottom right of the list.
There may be times when checking and unchecking individual variables is
inconvenient (e.g., when there are thousands of variable names). The bottom portion
of the dialog provides you with a control that allows you to select or unselect variables
by name. Simply enter the names of variables using wildcard characters if desired,
choose the types of interest, and click on the appropriate button.
For example, entering “A* B?” in the selection edit box, selecting only the Numeric
checkbox, and clicking on Unselect will uncheck all numeric series beginning with the
letter “A” and all numeric series with two character names beginning in “B”. To select
only series beginning with the letter “A”, enter “*” and click on Unselect, then enter “A*”
and click on Select.
When opening datasets that contain value labels, EViews will display a second tabbed
dialog page labeled Select maps, which controls the importing of value maps. On this
page, you will specify how you wish EViews to handle these value labels. You should
bear in mind that when opening datasets which do not contain value labels, EViews
will not display the value map tab.
The upper portion of the dialog contains a dropdown menu where you specify which
labels to read. You may choose between the default Attached to selected series,
None, All, or Selected from list.
The selections should be self-explanatory—Attached to selected series will only load
maps that are used by the series that you have selected for inclusion; Selected from
list (depicted) displays a map selection list in which you may check and uncheck
individual label names along with a control to facilitate selecting and deselecting labels
by name.
Lastly, the Filter obs page brings up an observation filter specification where you may
enter a condition on your data that must be met for a given observation to be read.
When reading the dataset, EViews will discard any observation that does not meet the
specified criteria. Here we tell EViews that we only wish to keep observations where
AGE>10.
Once you have specified the characteristics of your table read, click on OK to begin
the procedure.
EViews will open the foreign dataset, validate the type, create a workfile, read the
selected data, and if possible, apply a workfile structure. When the procedure is
completed, EViews will display an untitled group containing the series, and will display
relevant information in the status line. In this example, EViews will report that after
applying the observation filter it has retained 636 of the 1534 observations in the
original dataset.
The Workfile Window
Probably the most important windows in EViews are those for workfiles. Since open
workfiles contain the EViews objects that you are working with, it is the workfile window
that provides you with access to all of your data. Roughly speaking, the workfile
window provides you with a directory for the objects in a given workfile or workfile
page. When open, the workfile window also provides you with access to tools for
working with workfiles and their pages.
Workfile Directory Display
The standard workfile window view will look something like this:
In the title bar of the workfile window you will see the “Workfile” designation followed
by the workfile name. If the workfile has been saved to disk, you will see the name
and the full disk path. Here, the name of the workfile is “TESTFILE”, and it is located
in the “c:\eviews\data” directory on disk. If the workfile has not been saved, it will be
designated “UNTITLED”.
Just below the titlebar is a button bar that provides you with easy access to useful
workfile operations. Note that the buttons are simply shortcuts to items that may be
accessed from the main EViews menu. For example, the clicking on the Fetch button
is equivalent to selecting Object/Fetch from DB... from the main menu.
Below the toolbar are two lines of status information where EViews displays the range
(and optionally, the structure) of the workfile, the current sample of the workfile (the
range of observations that are to be used in calculations and statistical operations),
the display filter (rule used in choosing a subset of objects to display in the workfile
window), and an indicator for the order in which the objects in the workfile are
displayed. Here we see that the objects are currently in alphabetical order. You may
change the range, sample, and filter by double clicking on these labels and entering
the relevant information in the dialog boxes.
Lastly, in the main portion of the window, you will see the contents of your workfile
page in the workfile directory. In normal display mode, all named objects are listed in
the directory, sorted by name, with an icon showing the object type. The different types
of objects and their icons are described in detail in “Object Types”. You may also show
a subset of the objects in your workfile page, as described below in “Filtering the
Workfile Display”, or change the display order as outlined in
You may choose View/Name Display in the workfile toolbar to specify whether EViews
should use upper or lower case letters when it displays the workfile directory. The
default is lower case.
It is worth keeping in mind that the workfile window is a specific example of an object
window. Object windows are discussed in “The Object Window”.
Workfile Details Display
You may change the default workfile display to show additional information about your
objects. If you select View/Details+/–, or click on the Details +/- button on the toolbar,
EViews will toggle between the standard workfile display format, and a display which
provides additional information drawn from the label of each object. (See “Adding
Custom Attributes in the Label View” for details on modifying label information in your
objects.)
To size a column to the width of its longest text string, right-click on the column header
and select Size Column to Fit from the menu that appears. If you’d like to size all the
columns in the workfile view to accommodate the text within each, select Size All
Columns to Fit from the right-click menu.
By default, the Details view shows NAME, LAST UPDATE, and DESCRIPTION for
each object. You can customize this view to include any of the attributes in your
objects. Right-click on the column header and select Edit Columns... from the menu.
You will see a dialog displaying all available attributes in your workfile. These items
are a collection of the individual label attributes within each object. While each object
in the workfile may not have the same attributes, the dialog presents all possible
attributes that can be displayed as columns in the workfile Details view.
You will notice that initially, NAME, LAST UPDATE, and DESCRIPTION are checked,
indicating they are visible in the workfile Details view. To add additional columns, click
on the checkbox in front of the attribute you wish to see. You can reorder the columns
from within the dialog by selecting an attribute and clicking the up and down arrows
on the right-hand side. Again, the NAME column is locked in the first position and
cannot be moved or hidden. The attribute columns will be displayed in the workfile in
the order you specify after you click OK in the dialog.
All available information for each attribute will be displayed. However, some objects
may not contain label information for an attribute, in which case you will see a blank
cell in the attribute column.
Adding columns to the workfile Details view provides you with a convenient way to
look at information across the objects in your workfile. Instead of opening each object
to view its observation count, for instance, you can add OBS to the workfile and look
at the number of non-NA observations in every series in your workfile at once.
Additionally, there are many more attributes available via the Edit Columns dialog than
are visible in the Label view of an object. For instance, you can view the Start and End
dates of your objects in the workfile Details view by adding them as columns.
The sort function provides a method for grouping objects in your workfile. For example,
you could sort by the LAST UPDATE column to view objects that have been created
or modified recently, or by the SOURCE column to group objects from a particular
data source.
The rules EViews uses to sort the workfile window are intuitive, but it is worth
mentioning a couple of them. First, empty values are placed at the end of the list,
whether the column is sorted in ascending or descending order. Additionally, if you
add the FREQ attribute to display the frequency of each object and sort by this column,
you will see that frequency is sorted from low to high (or high to low), not by the letter
representation in the column. (You could have multiple frequencies if you have a
series link to another page of a different frequency, for instance.)
At the end of the list in the default Edit Columns dialog, you will see the items
“Deptype” and “Depspec”. These are the dependency type and dependency spec,
respectively. The dependency type provides information about the source of the data,
when appropriate. It may be empty or one of three values: “dblink”, “pagelink”, or
“formula”. The dependency spec gives additional information about the dependency.
For instance, if a series is based on a formula, its dependency type would be “formula”
and its dependency spec might be “log(x)”. If a series is a link from another workfile
page, its dependency type would be “pagelink”, and its dependency spec might
provide information about its source workfile page. Finally, a series that has been
pasted from a database would have the dependency type “dblink”, and the source
database name and series could be stored in the dependency spec.
To remove a column from view, unselect the checkbox in front of the item in the Edit
Columns... dialog. Alternately, right-click on the column you wish to remove, and select
Remove Column from the menu.
If you’d like to add a column without going through the Edit Columns... dialog, right-
click on any column header and choose Add Column.... The Add Column dialog will
appear, into which you may enter the name of the attribute you’d like to add as a
column in the workfile Details view. This field is not case sensitive, but otherwise must
match the attribute name exactly. You can also click the arrow on the dropdown menu
to select from a list of all available attributes. (This is the same list that is used to fill
the Edit Columns dialog.)
Note that Add Column..., Remove Column, and Edit Columns... modify the
appearance of the workfile Details view. They do not add or change attributes within
the objects. As such, you can add a column that doesn’t exist as an attribute for any
object in your workfile. EViews will display the column anyway, showing all blank
values.
You may customize each workfile page independently, choosing to display different
columns and grouping your objects differently according to the sort order.
When you save the workfile, the columns you have chosen to show will be stored,
along with their widths, the display order and the sort method. Your settings will be
saved whether the workfile is currently in Details view or not. You may also freeze the
workfile window in this view, providing you with a detailed table that can be copied or
saved. To save the table, right-click in the table and select Save table to disk....
Adding Your Own Label Attributes
While EViews provides a variety of attributes by default, you may like to add your own.
You can add them directly to individual objects, or globally from the workfile window.
To learn more about adding custom attributes to individual objects, which will then
appear in the list of attributes for the workfile Details view, see “Adding Custom
Attributes in the Label View”. Alternately, to add attributes to every object in the
workfile, you may use the tools provided in the workfile window.
From within a column header in the workfile Details window, right-click to bring up the
menu. We will turn our attention to the items in the middle of the menu (Clear Attribute
Values, Replace Attribute Values..., Rename/Merge Attribute..., and Import
Attributes...). These menu items modify the actual attributes within your objects, while
the items we have already discussed (Add Column..., Remove Column, and Edit
Columns...) simply change the appearance of the workfile Details view.
We will illustrate the use of these options with an example. Say we have a workfile
containing information on the population and output for a number of countries, from
1950 to 2000. For each country, there is a series with population data and one with
output data. The series are named such that a prefix indicates the series type (POP
for population and Y for output), and the last three characters specify the country. For
instance, the population series for Canada is POPCAN. We would like to flag each
series, so that we can easily see which contain population data and which contain
output data.
From the workfile Details view, we add a column named SERTYPE (select Add
Column... from the right-click menu, and enter “Sertype”). At this point, the attribute
does not exist in any of our objects, and so the column is blank. We would like to add
the attribute to the objects and populate it with information.
The values of an attribute can be set much easier if we first filter the workfile to show
only the objects we’d like to edit. Double-click on the word Filter in the top right-hand
corner of the workfile window to bring up the Object Filter dialog.
First, let’s label the series with population data. Enter “pop*” in the Name filter edit field
to filter the workfile to show only objects whose name begins with the letters “pop”,
and click OK. (See “Filtering the Workfile Display” for more information on filtering your
workfile.)
The workfile now shows only the series related to population, for each of the seven
countries included in our data.
Now, we go into the label view of the series named POPCAN, add the SERTYPE
attribute (see “Adding Custom Attributes in the Label View”), and set the value to
“population”. When we return to the workfile Details view, we will see “population”
under the SERTYPE column for the POPCAN series. The other series do not have a
SERTYPE attribute. You might imagine that adding the attribute and entering a value
for every series could be tedious, especially if our workfile contained series for more
countries. Let’s explore an easier method of globally modifying your attributes.
Right-click on the SERTYPE column to bring up the attribute modification dialog again,
and select Replace Attribute Values...
This dialog combines a few operations into one, by allowing you to enter a value into
one field and leave the other blank, or by entering data into both fields. In turn, you
can fill empty attributes with a value, replace a specific existing value with another
value, or reset attributes to blank. We will discuss each as we continue our example.
First, let’s add the SERTYPE attribute and fill it with the value “population” for the set
of objects we have filtered. In the Replace Attribute Value dialog, leave the first edit
field blank, enter “population” in the second edit field, and click OK. Note that this
dialog is case-sensitive. Since we brought up the dialog by right-clicking on the
SERTYPE column, this operation will replace all blank values of SERTYPE with
“population”, for all visible objects in the workfile. The SERTYPE attribute is new for
all objects except the POPCAN series. Since the SERTYPE value is already set in this
series, this operation will not modify its value. Click OK in the confirmation dialog to
complete the process. We will see that every series in our current workfile view has
been given the value “population” for its SERTYPE attribute.
Now we can add and populate the SERTYPE attribute for objects with output data.
Double-click the Filter text in the top right corner of the workfile window, bringing up
the Object Filter dialog again. This time, enter “y*” in the edit field to filter the workfile
to show only objects beginning with “y”, or those related to output, and click OK.
You may now right-click on the SERTYPE column, select Replace Attribute Values...,
and repeat the process for the second set of filtered objects. Leave the first edit field
blank, enter “output” in the second edit field, and click OK. The SERTYPE attribute will
be populated with the text “output” for all the filtered objects.
When we remove the workfile filter (open the Object Filter dialog and enter “*”), we will
see all our objects with the appropriate SERTYPE coding, indicating which series
provide population data and which provide data about the country’s output.
Now that we have populated all the objects, what if we notice that we typed “outPUT”
instead of “output” in the case-sensitive Replace Attribute Value dialog. This can be
easily fixed. Bring up the dialog again, and enter “outPUT” in the Replace existing
value field, and “output” in the With new value field.
When you click OK, you will be prompted by a dialog confirming that you wish to
replace all SERTYPE attributes containing the text “outPUT” with the text “output”.
Click OK to confirm. By using the Replace Attribute Value dialog, there was no need
to go into each object individually; the label information was updated globally. You
also didn’t need to refilter the workfile. Only attributes with the text “outPUT” were
modified.
Finally, the Replace Attribute Value dialog can also be used to clear specific attributes
based on their value. For instance, now that all our objects related to a country’s output
are coded with “output”, we could clear all SERTYPE attributes for these objects by
entering “output” in the first edit field, and leaving the second edit field blank. All
SERTYPE attributes with the value “output” will be removed from their objects.
Another item in the right-click menu that can be used to edit the underlying attributes
is Rename/Merge Attribute.... If you decide you would like your attribute to be named
SERIESTYPE instead of SERTYPE, you may use this dialog to globally edit the
attribute in all objects which are currently visible in your workfile. Right-click on the
SERTYPE column, and select Rename/Merge Attribute... to bring up the dialog. Enter
“Seriestype” and click OK. The SERTYPE attribute will be renamed SERIESTYPE in
all objects currently in your workfile filter.
Say you accidentally have your workfile filter set to show only objects related to
population (“pop*”) when you rename the SERTYPE attribute. When you reset the
filter to show all (“*”), you will see that the column has been renamed to SERIESTYPE,
and only objects with population data are showing their “population” attribute value.
The series with output data still have an attribute named SERTYPE, which is not
shown, as you no longer have a SERTYPE column in your workfile. If you now add
back a column for the SERTYPE attribute, (select Add Column... from the right-click
menu, and enter “Sertype”), you will see that all series are labeled, but half of the
values are in the SERTYPE attribute, and half are in the SERIESTYPE attribute. You
can remedy this using the Rename/Merge Attribute dialog.
With the filter set to all (“*”), right-click in the SERTYPE column and select
Rename/Merge Attribute.... Type “Seriestype” in the edit field, then click OK in the
dialog and for the confirmation message. Now, there will no longer be a SERTYPE
attribute, and all objects contain an attribute named SERIESTYPE.
We have described a rename operation with no conflicts. When you rename an
attribute to one that already exists, EViews attempts to merge the attribute values. The
attribute that you right-clicked on to bring up the dialog is considered the primary
attribute. First, the primary attribute will be renamed to the name you entered in the
edit field. Then, in preparing to delete the conflicting attribute, EViews tries to merge
the values for each object. If both attributes have values for a given object, the text of
the primary attribute is retained. If one attribute is blank, then the text is preserved,
whether it be from the primary or conflicting attribute. Once the values have been used
to populate the renamed attribute, the conflicting attribute and the contents of its label
values will be removed from all objects in the current workfile filter.
Another item in this section of the right-click menu is Clear Attribute Values. This option
clears the contents of an attribute and removes the attribute from every object,
provided it is not one of the fundamental locked types. Again, this is actually deleting
the label information and removing the attribute across the entire workfile; it is not
simply modifying the column in the workfile. You will see a warning dialog before the
clear operation is performed, indicating how many instances of the attribute were
found.
If we want to clear the SERIESTYPE attribute in our example, select Clear Attribute
Values from the right-click menu while the mouse is over the SERIESTYPE column.
EViews scans the workfile for objects containing the attribute SERIESTYPE, and
displays the number of objects found in the warning dialog. Click OK to remove the
label information and attribute from all the series we had labeled in our workfile.
The SERIESTYPE column will remain in the workfile Details view, even though the
attribute does not exist in any of our current objects. This is useful if we wish to add
and repopulate the attribute. Alternately, we might have had a filter on the workfile at
the time the clear operation was performed, such that when we return to a full view of
all objects, some will have the attribute and can display values in the column. (See
“Filtering the Workfile Display”.)
Importing Attributes
The previous example used a set of series which were named in such a way as to
make workfile filtering effective. We were able to isolate the series related to
population and those related to output quite easily. If your series are not named so
conveniently, the Import Attributes feature may be a better way to create and populate
your attribute.
Additionally, if you have the values of your attribute in some text format, you can setup
a workfile page containing the values, and then import them into your series.
To illustrate, say we have a workfile with the series objects D2, S1, and S2 and an
equation EQ1. We have received the data from different employees, and we’d like to
add an attribute named CREATOR to keep track of who contributed each series.
We need something to hold your attribute values and to provide information about
which value relates to which series. To accomplish this and get the information into
the EViews world, we use another workfile page.
Click on the New Page tab at the bottom of the workfile window and select Specify by
Frequency/Range... to bring up the Workfile Create dialog. It doesn’t matter what
frequency you use to define the new page; dates are completely irrelevant. What you
should pay attention to is the number of observations, as each observation will be
used to tie an attribute value to a series. In other words, you should have at least as
many observations as the number of series you wish to populate with an attribute
value.
We have four objects in our current workfile page, so if we have an attribute value for
each, our start and end dates should define at least four observations. The default
options create a new workfile page from 1950 to 2000, matching our current workfile.
While this provides more observations than necessary, we accept the default and click
OK. (We have also renamed the page to ATTRINFO by right-clicking on the new tab
after it is created.)
The method EViews uses to populate an attribute requires two things: the attribute
values and a list of the objects to receive these values. These are each held in an
alpha series. As such, we create two alpha series, named CREATOR and OBJNAME.
(This can be done by typing alpha creator and alpha objname into the command
window.)
The CREATOR series will hold the values for whichever objects we’d like to provide
information, and it is also the name of the attribute we will be defining. The OBJNAME
series indicates which objects will be receiving attribute information. The series are
aligned by observation number, such that the value of CREATOR for 1950 will be
assigned to the CREATOR attribute of the object specified in OBJNAME for 1950.
Here, we have filled SERNAME with a list of object names in our first workfile page.
Note that R5 does not exist, but this will not cause us problems. When entering the
object names, remember that copying from a workfile page copies the names of the
objects. You can then paste the names directly into an alpha series to get a list of your
objects.
Since we entered the object names as each employee submitted their data, they are
not in any particular order. This is fine, as long as the values in CREATOR are in the
same order.
We have entered names into the CREATOR series to indicate that Andy provided data
for the series S2, Mike provided D2, and so on.
If you have a source from which to copy and paste your text, this is clearly the easiest
method. However, even if you must enter the information manually, this importing
method is still superior to opening every object’s label view to enter each value
individually.
Filtering the Workfile Display
When working with workfiles containing a large number of objects, it may become
difficult to locate specific objects in the workfile directory display. You can solve this
problem by using the workfile display filter to instruct EViews to display only a subset
of objects in the workfile window. This subset can be defined on the basis of object
name as well as object type.
Select View/Display Filter… or double click on the Filter description in the workfile
window. The following dialog box will appear:
There are two parts to this dialog. In the edit field (blank space) of this dialog, you may
place one or several name descriptions that include the standard wildcard characters:
“*” (match any number of characters) and “?” (match any single character). Below the
edit field are a series of check boxes corresponding to various types of EViews objects.
EViews will display only objects of the specified types whose names match those in
the edit field list.
The default string is “*”, which will display all objects of the specified types. However,
if you enter the string:
x*
only objects with names beginning with X will be displayed in the workfile window.
Entering:
x?y
displays all objects that begin with the letter X, followed by any single character and
then ending with the letter Y. If you enter:
x* y* *z
all objects with names beginning with X or Y and all objects with names ending in Z
will be displayed. Similarly, the more complicated expression:
??y* *z*
tells EViews to display all objects that begin with any two characters followed by a Y
and any or no characters, and all objects that contain the letter Z. Wildcards may also
be used in more general settings—a complete description of the use of wildcards in
EViews is provided in Appendix A. “Wildcards” .
When you specify a display filter, the Filter description in the workfile window changes
to reflect your request. EViews always displays the current string used in matching
names. Additionally, if you have chosen to display a subset of EViews object types, a
“–” will be displayed in the Display Filter description at the top of the workfile window.
Changing the Display Order
You may change the order in which objects in the workfile are displayed by selecting
View/Display Order... or clicking on the Order in the upper right hand portion of the
workfile window.
EViews will display the Object Order dialog, prompting you for the attribute you wish
to use for sorting, and whether to use ascending or descending order.
There is a long is of attributes that you may use to determine order, including, among
others, Name, Last Update, Source, Description:
Workfile Summary View
In place of the directory display, you can display a summary view for your workfile. If
you select this view, the display will change to provide a description of the current
workfile structure, along with a list of the types and numbers of the various objects in
each of the pages of the workfile.
To select the summary view, click on View/Statistics in the main workfile menu or
toolbar. Here we see the display for a first page of a two page workfile.
To return to the directory display view, select View/Workfile Directory.
Saving a Workfile
You should name and save your workfile for future use. Push the Save button on the
workfile toolbar to save a copy of the workfile on disk. You can also save a file using
the File/Save As… or File/Save… choices from the main menu. EViews will display
the Windows common file dialog.
You can specify the target directory in the upper file menu labeled Save in. You can
navigate between directories in the standard Windows fashion—click once on the
down arrow to access a directory tree; double clicking on a directory name in the
display area gives you a list of all the files and subdirectories in that directory. Once
you have worked your way to the right directory, type the name you want to give the
workfile in the File name field and push the Save button.
Alternatively, you could just type the full Windows path information and name in the
File name edit field.
In most cases, you will save your data as an EViews workfile. By default, EViews will
save your data in this format, using the specified name and the extension “.WF1”. You
may, of course, choose to save the data in your workfile in a foreign data format by
selecting a different format in the dropdown menu. We explore the subject of saving
foreign formats below in “Exporting from a Workfile”.
Saving Updated Workfiles
You may save modified or updated versions of your named workfile using the Save
button on the workfile toolbar, or by selecting File/Save… from the main menu.
Selecting Save will update the existing workfile stored on disk. You may also use
File/Save As… to save the workfile with a new name. If the file you save to already
exists, EViews will ask you whether you want to update the version on disk.
When you overwrite a workfile on disk, EViews will usually keep a backup copy of the
overwritten file. The backup copy will have the same name as the file, but with the first
character in the extension changed to ~. For example, if you have a workfile named
“Mydata.WF1”, the backup file will be named “Mydata.~f1”. The existence of these
backup files will prove useful if you accidentally overwrite or delete the current version
of the workfile file, or if the current version becomes damaged.
If you wish to turn on or off the creation of these backup copies you should set the
desired global options by selecting Options/Workfile Storage Defaults..., and selecting
the desired settings.
Workfile Save Options
By default, when you click on the Save button, EViews will display a dialog showing
the current global default options for storing the data in your workfile.
Your first choice is whether to save your series data in either Single precision or
Double precision. Single precision will create smaller files on disk, but saves the data
with fewer digits of accuracy (7 versus 16).
You may also choose to save your data in compressed or non-compressed form. If
you select Use compression, EViews will analyze the contents of your series, choose
an optimal (lossless) storage precision for each series, and will apply compression
algorithms, all to reduce the size of the workfile on disk. The storage savings may be
considerable, especially for large datasets containing lots of integer and 0, 1 variables.
We caution however, that a compressed workfile is not backward compatible, and will
not be readable by versions prior to EViews 5.
There is also a checkbox for showing the options dialog on each save operation. By
default, the dialog will be displayed every time you save a workfile. Unchecking the
Prompt on each Save option instructs EViews to hide this dialog on subsequent saves.
If you later wish to change the save settings or wish to display the dialog on saves,
you must update your global settings by selecting Options/General Options... from the
main EViews menu and going to the Data storage/Workfile save portion of the dialog.
Note that, with the exception of compressed workfiles, workfiles saved in EViews 9
may be read by previous versions of EViews. Objects with features that are not
supported by early versions will, however, be dropped when read by those versions
of EViews. You should take great caution when saving workfiles using older versions
of EViews as you will lose any deleted objects).
Note also that only the first page of a multi-page workfile will be read by versions prior
to EViews 5; all other pages will be dropped. You may save individual pages of a multi-
page workfile to separate workfiles so that they may be read by versions that do not
support multiple pages; see “Saving a Workfile Page”.
Snapshot Backup
Workfile backup “snapshots” may be taken manually to save the current state of the
workfile. EViews also supports automatic snapshots taken periodically to allow you to
easily roll back a workfile to a previous state and/or investigate changes made to your
workfile between points.
When you have a workfile open in EViews, click the Snapshot button to instruct
EViews to save a copy of the workfile at that point in time. You may specify your own
label and description for the snapshot. EViews will also let you include any captured
commands that were generated since the last snapshot (if any). All of this information
will be saved along with the snapshot as the snapshot's metadata.
Automatic Snapshots
By default, EViews will automatically check for workfile changes every five minutes
and then save a snapshot for you. These “auto” snapshots will be mixed in with any
manual snapshots taken by you, but will usually be deleted when the workfile is closed.
You can change the default snapshot settings in the General Options/Snapshots
dialog.
Snapshots are usually saved in a hidden folder in the same directory as the main
workfile. However, you can group all the snapshot folders in the same location by
specifying a common snapshot folder.
For automatic snapshots, you can change how often EViews performs the check, and
whether snapshots should be kept if no changes are detected. You can also tell
EViews to not discard auto snapshots when the workfile is closed and to limit how
many auto snapshots should be allowed. Setting this value to zero will allow unlimited
auto snapshots.
Viewing Snapshots
To view available snapshots for a workfile, click the View button and switch to the
Snapshots view.
The tree on the left will display all available snapshots with the most recent snapshot
at the top. If you click on a snapshot, you can see the snapshot metadata and also a
quick comparison of objects that have changed between then and now.
In this example, the comparison view shows that the current X object in our workfile is
different from the snapshot that was taken today at 8:54 a.m.
Double-clicking the “page1\x” row will display a new group window that shows the
exact differences.
Alternatively, you can also right-click the "8:54" node and select Open… (or simply
double-click the node) to open the snapshot as its own workfile.
Now with both workfiles open, you can easily inspect differences and copy over
individual observations by hand.
Of course, if you'd simply like to revert the entire workfile to be the same as the
selected snapshot, you can right-click the snapshot node and select Revert To. This
will load the snapshot as the current workfile. Saving the workfile at this point will then
overwrite the previous version of the file.
See the wfsnapshot command for additional information.
Popup
Loading a Workfile
You can use File/Open/EViews Workfile… to load into memory a previously saved
workfile. You may also drag-and-drop the workfile onto your EViews workspace. You
will typically save a workfile containing all of your data and results at the end of the
day, and later load the workfile to pick up where you left off.
When you select File/Open/EViews Workfile… you will see a standard Windows file
dialog. Simply navigate to the appropriate directory and double click on the name of
the workfile to load it into RAM. The workfile window will open and all of the objects in
the workfile will immediately be available.
For convenience, EViews keeps a record of the most recently used files at the bottom
of the File menu. Select an entry and it will be opened in EViews.
The current version of EViews can read workfiles from all previous versions of EViews.
Due to changes in the program, however, some objects may be modified when they
are read into the current version.
Popup
Multi-page Workfiles
While a great many of your workfiles will probably contain a single page, you may find
it useful to organize your data into multiple workfile pages. Multi-page workfiles are
primarily designed for situations in which you must work with multiple datasets.
For example, you may have both quarterly and monthly data that you wish to analyze.
The multi-page workfile allows you to hold both sets of data in their native frequency,
and to perform automatic frequency conversion as necessary. Organizing your data
in this fashion allows you to switch instantly between performing your analysis at the
monthly and the quarterly level.
Likewise, you may have a panel dataset on individuals that you wish to use along with
a cross-sectional dataset on state level variables. By creating a workfile with a
separate page for the individual level data, and a separate page for the state level
data, you can move back and forth between the individual and the state level analyses,
or you can link data between the two to perform dynamic match merging.
Creating a Workfile Page
At the top of the dialog is a dropdown menu labeled Method that you may use to select
between the various ways of using identifiers to specify a new page. You may choose
between creating the page using: (1) the unique ID values from the current workfile
page, (2) the union of unique ID values from multiple pages, (3) the intersection of
unique ID values from multiple pages, (4) and (5) the cross of the unique values of two
ID series, (6) the cross of a single ID series with a date range.
As you change the selected method, the dialog will change to provide you with
different options for specifying identifiers.
Unique values of ID series from one page
The easiest way to create a new page from identifiers is to use the unique values in
one or more series in the current workfile page.
If you select Unique values of ID series from one page in the Method dropdown,
EViews will prompt you for one or more identifier series which you should enter in the
Cross-section ID series and Date series edit fields.
EViews will take the set of series and will identify the unique values in the specified
Sample. Note that when multiple identifiers are specified, the unique values are
defined over the values in the set of ID series, not over each individual series.
The new page will contain identifier series containing the unique values, and EViews
will structure the workfile using this information. If Date ID series were provided in the
original dialog, EViews will restructure the result as a dated workfile page.
Suppose, for example, that we begin with a workfile page named UNDATED that
contains 471 observations on 157 firms observed for 3 years. There is a series FCODE
identifying the firm, and a series YEAR representing the year.
We first wish to create a new workfile page containing 157 observations representing
the unique values of FCODE. Simply enter FCODE in the Cross-section ID series, set
the sample to “@ALL”, name the new page “UNDATED1”, and click on OK.
EViews will create a new structured (undated - with identifier series) workfile page
UNDATED1 containing 157 observations. The new page will contain a series FCODE
with the 157 unique values found in the original series FCODE, and the workfile will
be structured using this series.
Similarly, we may choose to create a new page using the series YEAR, which identifies
the year that the firm was observed. There are three distinct values for YEAR in the
original workfile page (“1987,” “1988,” “1989”). Click on the Click on the New Page tab
and select Specify by Identifier Series... from the menu, and Unique values of ID series
from one page in the Method dropdown. Enter “YEAR” in the Date ID series field, and
click on OK to create a new annual page with range 1987–1989. Note that EViews will
structures the result as a dated workfile page.
Union of common ID series from multiple pages
In some cases, you may wish to create your new page using unique ID values taken
from more than one workfile page.
If you select Union of common ID series from multiple pages, EViews will find, for each
source page, a set of unique ID values, and will create the new workfile page using
the union of these values. Simply enter the list of identifiers in the Cross-section ID
series and Date series and edit fields, and a list of pages in which the common
identifiers may be found. When you click on OK, EViews will first make certain that
each of the identifier series is found in each page, then will create the new workfile
page using the union of the observed ID values.
We may extend our earlier example where there are three distinct values for YEAR in
the original page (“1987,” “1988,” “1989”). To make things more interesting, suppose
there is a another page in the workfile, ANNUAL5, containing annual data for the years
1985–1988 and that this page contains also contains a series YEAR with those values
(“1985,” “1986,” “1987,” “1988”).
Since we want to exploit the fact that YEAR contains date information, we create a
page using the union of IDs by selecting Union of common ID series from multiple
pages, entering YEAR in the Date series field, and then entering “UNDATED” and
“ANNUAL5” in the page field. When you click on OK, EViews will create a 5
observation, regular annual frequency workfile page for 1987–1989, formed by taking
the union of the unique values in the YEAR series in the UNDATED panel page, and
the YEAR series in the ANNUAL5 page.
Intersection of common ID series from multiple pages
In other cases, you may wish to create your new page using common unique ID values
taken from more than one workfile page. If you select Intersection of common ID series
from multiple pages, EViews will take the specified set of series and will identify the
unique values in the specified Sample. The intersection of these sets of unique values
across the pages will then be used to create a new workfile page.
In our extended YEAR example, we have two pages: UNDATED, with 471
observations and 3 distinct YEAR values (“1987,” “1988,” and “1989”); and the
ANNUAL4 workfile page containing annual data for four years from 1985–1988, with
corresponding values for the series YEAR.
Suppose that we enter YEAR in the Date ID field, and tell EViews to examine the
intersection of values in the Multiple pages UNDATED and ANNUAL4. EViews will
create a new workfile page containing the intersection of the unique values of the
YEAR series across pages (“1987,” “1988”). Since YEAR was specified as a date ID,
the page will be structured as a dated annual page.
Cross of two ID series
There are two choices if you wish to create a page by taking the cross of the unique
values from two ID series: Cross of two non-date ID series creates an undated panel
page using the unique values of the two identifiers, while Cross of one date and one
non-date ID series uses the additional specification of a date ID to allow for the
structuring of a dated panel page.
Suppose for example, that you wish to create a page by crossing the 187 unique
FCODE values in the UNDATED page with the 4 unique YEAR values in the
ANNUAL4 page (“1985,” “1986,” “1987,” “1988”). Since the YEAR values may be used
to create a dated panel, we select Cross of one date and one non-date ID from our
Method dropdown.
Since we wish to use YEAR to date structure our result, we enter “FCODE” and
“UNDATED” in the Cross ID series and Cross page fields, and we enter “YEAR” and
“ANNUAL4” in the Date ID series and Date page fields.
When you click on OK, EViews will create a new page by crossing the unique values
of the two ID series. The resulting workfile will be an annual dated panel for 1985–
1988, with FCODE as the cross-section identifier.
It is worth noting that had we had entered the same information in the Cross of two
non-date ID dialog, the result would be an undated panel with two identifier series.
Cross of ID Series with a date range
In our example of crossing a date ID series with a non-date ID, we were fortunate to
have an annual page to use in constructing the date ID. In some cases, the dated
page may not be immediately available, and will have to be created prior to performing
the crossing operation.
In cases where the page is not available, but where we wish to cross our non-date ID
series with a regular frequency range, we may skip the intermediate page creation by
selecting the Cross of ID series with a date range method.
Here, instead of specifying a date ID series and page, we need only specify a page
frequency, start, and end dates. In this example, the resulting annual panel page is
identical to the page specified by crossing FCODE with the YEAR series from the
ANNUAL page.
While specifying a frequency and range is more convenient than specifying a date ID
and page, this method is obviously more restrictive since it does not allow for irregular
dated data. In these latter cases, you must explicitly specify your date ID series and
page.
Creating a Page by Copying from the Current Page
You may also create a new workfile page by copying data from the current page. Click
on New Page or click on Proc in the main workfile menu, and select Copy/Extract from
Current Page and either By Link to New Page... or By Value to New Page or
Workfile.... EViews will open a dialog prompting you to specify the objects and data
that you wish to copy to a new page. See “Copying from a Workfile” for a complete
discussion.
Alternately, you may simply drag-and-drop a group of selected series from the current
workfile page onto the New Page tab on the bottom of the workfile window.
More directly, you may drag an existing workfile, workfile page, or foreign data file
directly onto the New Page tab on the bottom of your workfile window. You can even
copy a page from one workfile to another by dragging the page tab from the source
workfile and dropping onto the New Page in the other workfile.
If you select an existing EViews workfile, EViews will add a page corresponding to
each page in the source workfile. If you load a workfile with a single page named
QUARTERLY, EViews will attempt to load the entire workfile in the new page. If your
workfile contains multiple pages, each page of the workfile will be loaded into a new
and separate page. The active page will be the newest page.
If you select a foreign data source as described in “Creating a Workfile by Reading
from a Foreign Data Source”, EViews will load the data into a single newly created
page in the workfile. This method is exactly the same as that used when creating a
new workfile except that the results are placed in a new workfile page.
Creating a Page by Pasting from the Clipboard
You may create a new workfile page by pasting the contents of the Windows
Clipboard. This method is particularly useful for copying and pasting data from another
application such as Microsoft Word, Excel, or your favorite web browser.
Simply copy the data you wish to use in creating your page, then click on New Page
and select Paste from Clipboard as Page. EViews will first analyze the contents of the
clipboard. EViews then creates a page to hold the data and then will read the data into
series in the page.
Note that while EViews can correctly analyze a wide range of data representations,
the results may not be as expected in more complex settings.
Working With Workfile Pages
While workfile pages may generally be thought of simply as workfiles, there are certain
operations that are page-specific or fundamental to multi-page workfiles.
Setting the Active Workfile Page
To select the active workfile page, simply click on the visible tab for the desired page
in the workfile window. The active page is noted visually by the tab selection at the
bottom of the workfile window.
If the desired page is not visible, you may click on the small right and left arrows in the
bottom left-hand corner of the workfile window to scroll the page tab display until the
desired page is visible, then click on the tab.
You should note that it is possible to hide existing page tabs. If a page appears to be
missing, for example if New Page is the only visible tab, the remaining tabs are
probably hidden. You should click on the left arrow located in the bottom right of the
workfile window until your page tabs are visible.
Renaming a Workfile Page
EViews will give your workfile pages a default name corresponding to the workfile
structure. You may wish to rename these pages to something more informative.
Simply click on the tab for the page you wish to rename and right-mouse-button click
to open the workfile page menu. Select Rename Workfile Page... from the menu and
enter the page name. Alternatively, you may select Proc/Rename Current Page... from
the main workfile menu to call up the dialog.
Workfile page names must satisfy the same naming restrictions as EViews objects.
Notably, the page names must not contain spaces or other delimiters.
Deleting a Workfile Page
To delete a workfile page, right mouse click on the page tab and select Delete Workfile
Page, or with the page active, click on the Proc menu and select Delete Current Page.
Saving a Workfile Page
If you wish to save the active workfile page as an individual workfile, click on the page
tab, right mouse click to open the workfile page menu and select Save Workfile Page...
to open the SaveAs dialog. Alternatively, you may select Proc/Save Current Page...
from the main workfile menu to access the dialog.
Saving a page as an individual workfile is quite useful when you wish to load a single
page into several workfiles, or if you wish to use the page in a previous version of
EViews. Once saved on disk, it is the same as any other single-page EViews workfile.
Reordering Workfile Pages
You may change the order of your workfile pages by dragging the tab for a page at
the bottom of the workfile window, and dropping it on top of the tab for the page it
should follow. Note the difference in behavior between dragging a tab within a workfile
and dragging across workfiles. The first reorders the pages, while the second copies
the contents of one page into another.
Working with Series Across Pages
When working with multi-page workfiles you may wish to access the data in one page
when performing calculations or analysis on another page. EViews offers three
methods for access data across pages; simple copying (“Copying and Pasting”),
creating link objects (“Series Links”), and auto-series across pages (“Auto-series
Across Pages”).
Popup
Comparing Workfiles
When working with different workfiles, or across different workfile pages, it can be
useful to quickly see any differences in the objects contained in the different
files/pages. The View/Compare... menu item allows you to compare your current
workfile (or more optionally the current page) with a different workfile stored on disk,
or a separate page.
Once you click on View/Compare, a dialog will appear asking you to select which files
to compare, and which objects within those files to compare.
The Current Values area lets you select whether you wish to compare objects in all of
the pages in the current workfile, or only objects in the current page by specifying the
Compare object in: dropdown box. You may also choose to compare only a subset of
objects in the current workfile or page by using the Matching name pattern: field to
enter a naming pattern. For example, if you only wish to compare objects whose
names begins with “US_”, you would enter “US_*” in the box.
You may specify the comparison objects in the Baseline Values area. The Against
objects in: dropdown box lets you specify whether you wish to compare against objects
in a separate workfile saved on disk (by selecting Saved File), or against objects in
the current workfile. If you choose to compare against a file on disk, you should type
the path and filename of the file in the edit field below the dropdown. Alternatively, you
can click the “...” button to select the file using a standard file dialog.
If you chose to compare only objects in the current workfile page in the Current Values
area, you may select a comparison page to compare against by entering its name in
the Page: field.
The Matching name pattern: field again allows you to choose a subset of objects to
compare. Note that you do not need to use the same naming pattern as in the Current
Values area. This means you may compare all objects starting with “US_” with all
objects starting with “UK_” by entering “UK_*” in this field.
You should note that if you leave the Page: field blank and have selected Current
Workfile in the Against objects in: dropdown, EViews will use the current workfile page
as the comparison page. Since you have chosen to compare the current page in the
current workfile against the current page in the current workfile (i.e. the same page
twice), EViews will report no differences between objects, unless you have used
different name patterns for Current Values and Baseline Values.
Note that by default the settings in the Current Values and the Baseline Values areas
are set such that the current workfile is compared against the version of the same
workfile currently saved on disk. This is useful when trying to track what changes you
have made in your current session (since you last saved to disk), or what has updated
when you update links in you workfile.
The Tolerance box lets you specify the degree of tolerance to use when deciding if
objects have differences. By default, it is set to a very small number (1e-15), which
should capture any real differences between objects.
Finally, the Output area lets you specify which types of changes in objects to report.
Including Added items tells EViews to report any objects that exist in the current
workfile (or page), but not in the baseline workfile (or page). Deleted items are objects
that do not exist in the current workfile but do in the baseline. Items that have been
Replaced are objects that exist in both current and baseline workfiles, but have
different object types (for example, it may be an Equation in the current workfile, but
a System in the baseline). Converted objects are series objects which have different
frequencies.
Modified objects are objects that exist in both current and baseline workfiles, are the
same type and frequency, yet have different values for at least one observation.
Unchanged objects are objects that are identical in both. Finally, Skipped objects are
objects that exist in both workfiles and have the same type, but cannot have their
values compared. Equations, for example, cannot be compared between workfiles,
and so they are skipped.
As an example, we compare two workfiles, Demo1.wf1 and Demo2.wf1. The results
are show below:
The top of the output gives a summary of the comparison. Here demo2 (the current
workfile) was compared against demo1.wf1. Eleven objects were compared, with four
being skipped and four containing differences.
The main table of the output shows the specifics of the comparison. The first object
containing differences is EQ02. This object shows “deleted”, meaning that it was
present in Demo1 (the baseline workfile), but not in Demo2. Conversely, the graph
object, G1, is shown as “added”, meaning it is present in Demo2 but not Demo1.
The series GDP is showing as “modified”. That means that at least one observation
contains different values. In fact, looking at the Revised column of the table we can
see that only a single observation contains differences. The First and Last columns
show the first and last dates that contain differences. Since we only have a single
observation that is different, in this case they show the same date, 1953Q1. The
Delta% column indicates that the difference between the value in Demo1 and Demo2
is only 0.6%.
Finally, the series M1 shows “modified”. It does not have an entry in the Revised
column, but has an entry in the End column instead. This indicates that the series M1
has more observations of data in Demo2 than it did in Demo1. Indeed, the End column
indicates that there are four extra periods of observations and the end of the workfile.
Note that an entry in the Start column would have indicated that there were more
observations with data at the start of the workfile for that particular series.
Popup
Addendum
File Dialog Features
There are additional features in the file open and save dialogs which you may find
useful.
Set Default Directory
All EViews file dialogs begin with a display of the contents of the default directory. You
can always identify the default directory from the listing on the EViews status line. The
default directory is set initially to be the directory containing the EViews program, but
it can be changed at any time.
You can change the default directory by using the File/Open… or the File/Save As…
menu items, navigating to the new directory, and checking the Update Default
Directory box in the dialog. If you then open or save a workfile, the default directory
will change to the one you have selected. The default directory may also be set from
the Options/File locations... dialog. See “File Locations” .
An alternative method for changing the default EViews directory is to use the cd
command. Simply enter “CD” followed by the directory name in the command window
(see cd for details).
File Operations
Since EViews uses a variant of the Windows common file dialog for all open and save
operations, you may use the dialog to perform routine file operations such as
renaming, copying, moving, and deleting files.
For example, to delete a file, click once of the file name to select the file, then right
click once to call up the menu, and select Delete. Likewise, you may select a file, right-
mouse click, and perform various file operations such as Copy or Rename.
Cloud Drive Support
You may access files on your cloud drive from within EViews. There is a combo on
the File Open… and File/Save As… dialogs that allows you to configure access to
your Box, Dropbox, Google Drive, or OneDrive and to read and write files directly from
your cloud drives.
Additionally, many of our commands that take a path to a file can now be used with a
cloud location. For example:
cd "<myonedrive>:\temp"
wfopen "<mydropboxdrive>:\folder\main.wf1"
wfsave "<mygoogledrive>:\EViews\test.wf1"
To access files in your account you must first configure a cloud location within EViews.
Click on File Open... and then select New Location from the Browse Location
dropdown menu.
EViews will display a New Location dialog prompting you to select a service provider
and to provide a name for use when referring to the location:
Click the Authorize button to start the sign-in and authorization process. The
authorization procedure will differ for each provider, but will generally involve
launching a browser window and opening the appropriate sign-in page (if are already
signed in to your cloud account, your provider may not require this additional
authorization).
Once signed in, you will be prompted to allow EViews access to your files and folders.
Click the Allow button to authorize EViews access. Once authorization has been
granted, you will see a message saying you can now close the browser window and
return to the EViews New Location dialog.
Notice that the OK button is now enabled, indicating that you may save the location.
The Remember Provider checkbox allows you to control the lifetime of this cloud
location. If you wish to use the new location only once (such as when you are using
a public/lab computer) then leave the Remember Provider checkbox unchecked. This
will ensure the location is only available to the current instance of EViews. Once
EViews is shutdown, the cloud location will no longer be available. However, if you are
using a private computer and would like to access this cloud location in the future, you
may select this option so that EViews will remember this cloud location for as long as
the cloud provider allows (or until you instruct EViews to forget).
Security Note: Cloud location information is stored on the local machine in encrypted
format and never contains any user passwords.Stored locations are only available to
the current Windows user. Some cloud providers will always require re-authorization
after a certain period of time, regardless of activity.
Once the location has been created, the File Open… dialog will be displayed, with the
Browse Location dropdown set to the newly created location, so that you may examine
the contents of your cloud drive.
You can create, edit, and delete cloud locations using the Cloud Management dialog.
To display the dialog, select Options/Cloud Management from the main EViews menu:
From here you can see relevant information such as the local name of the location,
the provider, the user account associated with the location, and whether or not the
location has been saved.
Cloud FAQ
• Which EViews files can be opened/saved to a cloud location?
Most file formats are supported, including EViews Workfiles, Programs, Text Files,
Excel Files, etc. The one notable exception to that are EViews Database files (*.EDB).
• I’m concerned about my cloud account security. Is my account password saved
locally?
No. EViews does not have access to your account password. Authorization is
negotiated between you and your provider via your browser. The cloud provider sends
EViews a special authorization key and EViews keeps this special key in encrypted
format. All authorizations can be revoked by the provider whenever you request,
forcing cloud clients such as EViews to obtain new authorization for continued access
to your files.
• Are cloud files cached locally? If so, where?
When a file is opened or saved to a cloud location, all files are cached locally to the
following directory:
<EViews Temp File Path>\<location name>. Cached files will be automatically
removed after the end of the session if your cloud location was not defined using the
Remember Provider setting.
Popup
III. Introduction
The following sections provide an initial introduction to the use of EViews:
“What is EViews?”
EViews provides sophisticated data analysis, regression, and forecasting tools on
Windows-based computers. With EViews you can quickly develop a statistical relation
from your data and then use the relation to forecast future values of the data. Areas
where EViews has proven to be useful include: scientific data analysis and evaluation,
financial analysis, macroeconomic forecasting, simulation, sales forecasting, and cost
analysis.
EViews is a new version of a set of tools for manipulating time series data originally
developed in the Time Series Processor software for large computers. The
predecessor of EViews was MicroTSP, first released in 1981. Though EViews was
developed by economists with an emphasis on time series analysis, there is nothing
in its design that limits its usefulness to economic time series.
EViews provides convenient visual ways to enter data series from the keyboard or
from files, to create new series from existing ones, to display and print series, and to
carry out statistical analysis of the relationships among series.
EViews takes advantage of the visual features of modern Windows software. You can
use your mouse to guide the operation with standard Windows menus and dialogs,
and capture those operations for later use. Results appear in windows and can be
manipulated with standard techniques.
Alternatively, you may use EViews’ powerful command and batch processing
language. You can enter and edit commands in the command window. You can create
and store the commands in programs that document your research project for later
execution.
For example, here we click on the Object entry in the main menu to reveal a drop-
down menu. Notice that some of the items in the drop-down menu are listed in black
and others are in gray. In menus, black items may be executed while the gray items
are not available. In this example, you cannot create a New Object or Store an object,
but you can Print and View Options. We will explain this behavior in our discussion of
“The Object Window”.
The Command Window
Below the menu bar is an area called the command window. EViews commands may
be typed in this window. The command is executed as soon as you hit ENTER.
The vertical bar in the command window is called the insertion point. It shows where
the letters that you type on the keyboard will be placed. As with standard word
processors, if you have typed something in the command area, you can move the
insertion point by pointing to the new location and clicking the mouse. If the insertion
point is not visible or your keystrokes are not appearing in the window, it probably
means that the command window is not active (not receiving keyboard focus); simply
click anywhere in the command window to tell EViews that you wish to enter
commands.
To toggle between the active window and the command window, press F5.
See “Window Behavior” for a discussion of focus settings which affect the use of the
command window.
Command Editing
The command window supports Windows cut-and-paste so that you can easily move
text between the command window, other EViews text windows, and other Windows
programs. The contents of the command area may also be saved directly into a text
file for later use: make certain that the command window is active by clicking anywhere
in the window, and then select File/Save As… from the main menu.
If you have entered more commands than will fit in your command window, EViews
turns the window into a standard scrollable window. Simply use the scroll bar or up
and down arrows on the right-hand side of the window to see various parts of the list
of previously executed commands. You may move the insertion point to previously
executed commands, edit the existing command, and then press ENTER to execute
the edited version of the command.
Alternately, to display a list of previous commands in the order in which they were
entered, press the Control key and the UP arrow (CTRL+UP). The last command will
be entered into the command window. Holding down the CTRL key and pressing UP
repeatedly will display the next prior commands. Repeat until the desired command is
recalled.
To examine a history of the last 30 commands, press the Control Key and the J key
(CTRL+J). In the popup window you may use the UP and DOWN arrows to select the
desired command and then press the ENTER key to add it to the command window,
or simply double click on the command. To close the history window without selecting
a command, click elsewhere in the command window or press the Escape (ESC) key.
To execute the retrieved command, simply press ENTER again. You may first edit the
command if you wish to do so.
You may find that the default size of the command window is too large or small for
your needs. You can resize the command window by placing the cursor at the bottom
of the command window, holding down the mouse button and dragging the window up
or down. Release the mouse button when the command window is the desired size.
Undocking the Command Window
You may undock and drag the command window to anywhere on your windows
desktop.
The left section will sometimes contain status messages sent to you by EViews. These
status messages can be cleared manually by clicking on the box at the far left of the
status line. The next section shows the default directory that EViews will use to look
for data and programs. The last two sections display the names of the default database
and workfile. In later chapters, we will show you how to change both defaults.
The Work Area
The area in the middle of the window is the work area where EViews will display the
various object windows that it creates. Think of these windows as similar to the sheets
of paper you might place on your desk as you work. The windows will overlap each
other with the foremost window being in focus or active. Only the active window has a
darkened titlebar.
When a window is partly covered, you can bring it to the top by clicking on its titlebar
or on a visible portion of the window. You can also cycle through the displayed
windows by pressing the F6 or CTRL-TAB keys.
Alternatively, you may select a window by clicking on the Window menu item, and
selecting the desired name.
You can move a window by clicking on its title bar and dragging the window to a new
location. You can change the size of a window by clicking on any corner and dragging
the corner to a new location.
Custom Edit Fields in Eviews
Most of your interactive work in EViews will consist of entering information in dialogs.
Dialogs in EViews work much like dialogs in any other program, a window will open
prompting you to manipulate controls and to enter information in edit fields.
EViews offers custom edit fields that provide smart auto-complete and automatic
expansion, simplifying the task of entering the required information.
Smart Auto-Complete
Many dialogs in EViews require the user to enter the names of one or more objects in
the workfile (see “Object Basics” for a detailed description of objects). You may, for
example be prompted for the name of explanatory variables to use in a regression, or
for the name of a vector to use in initializing a procedure.
Smart auto-complete allows you to easily enter the required object names in edit fields,
generally by bringing up a list of available objects workfile from which you may select.
Where possible, EViews restricts the list of objects to include only those that make
sense given the context of the edit field.
• If you press CTRL-L, EViews will display a list of objects for you to make a selection.
The list display will centered on the closest match to what you have already typed.
• If you type CTRL-space, EViews will add a unique matching object name to the edit
field or display the list.
By default, smart auto-complete will display the list so that the list pops up
automatically after a delay in typing, but you may configure so that list is only displayed
when you press CTRL-L (or CTRL-space when there is no unique match).
For example, when you specify an equation in EViews you will be prompted the names
of variables (series objects) or groups of series (a group object) to be used in
estimation in an edit field. In the example below, we started typing “MSFT”, and
EViews brought up a list of all series and groups in the workfile, and centered the list
on the first object whose name start with “MSFT”.
Continuing to type will change the list centering. You may also use the scroll bar to
display a different portion of the list.
If EViews finds at least one object in the workfile that matches your text, the first such
name will be selected, and the name will be shaded to indicate this selection. You may
continue to type to refine the selection, or you may use the scroll bar and mouse to
select an alternate object.
Single clicking on a name will display a description of the selected object, if one is
available. Double-clicking, hitting ENTER, or pressing the TAB key will add the name
of the selected object to the edit field. Pressing ESC closes the list and returns you to
the dialog without altering the edit field.
If there are no objects that match your text, the list will be centered on the nearest
match, but the object will not be selected. The lack of selection will be indicated by an
open box around the name:
When there is no object selected, pressing TAB will add the name of the nearest match
(indicated by the open box) to the edit field. Pressing ESC will close the list and return
you to the dialog, without making additional changes. Hitting RETURN does not add
the nearest match name to the edit field, but instead closes the list and enters a
RETURN keystroke in the original edit field.
You may modify the automatic pop-up behavior of the smart auto-complete using the
EViews global keyboard options. See “Keyboard”.
Expanded Edit fields
In more complex dialogs, size is at a premium so that individual edit fields may be too
small to enter information without horizontal or vertical scrolling. Edit field expansion
lets you increase the size of edit fields in EViews so that you may more easily see and
enter information. To expand an edit field, simply double click on the white space in
the box, or right click and select Expand.
EViews will bring up a new edit box, filled with the contents of the original edit field.
You may type, copy-and-paste and do all of the standard operations with this edit field.
The edit field may also be resized by dragging the lower right-hand corner.
After you modify the edit field contents and click on OK EViews will copy your entered
text into the original edit field and close the expanded edit field. If you click on Cancel,
the box closes, but the edited contents are discarded. The contents of the original edit
field will be retained.
“Breaking or Canceling in EViews”
EViews follows the Windows standard in using the ESC key as the break key. If you
wish to cancel the current task or ongoing operation, simply press ESC.
“Closing EViews”
There are a number of ways to close EViews. You can always select File/Exit from the
main menu, or you can press ALT-F4. Alternatively, you can click on the close box in
the upper right-hand corner of the EViews window, or double click on the EViews icon
in the upper left-hand corner of the window. If necessary, EViews will warn you and
provide you with the opportunity to save any unsaved work.
“Where to Go For Help”
Technical Support
Technical support on the operation of EViews is available by phone or (preferably)
email. Email support inquiries should be addressed to [email protected]. Please
include your your serial number.
The EViews Forum
To supplement the information provided in the manuals and the help system, we
encourage you to visit the EViews Forum where you can find answers to common
questions about installing, using, and getting the most out of EViews. The Forum is an
ideal place to ask questions of and share information with other EViews users. The
forum address is: http://forums.eviews.com.
EViews Updates
IHS Global Inc. occasionally releases patches to the EViews program, and we strongly
recommend that you keep your copy of EViews as up-to-date as possible.
EViews includes an automatic updating feature that can check for new updates every
day, and install any update that may be available. The automatic update feature can
be disabled from the Options/EViews Auto-Update from Web item in your main
EViews menu. You can also manually check for updates from within EViews at any
time by selecting Check now... under the EViews Auto-Update from Web menu item,
or by selecting EViews Update from the Help menu.
You may also check for updates to the EViews program or for updates to
supplementary components such as the EViews documentation or sample data and
programs manually by visiting the Download section of the EViews website
(www.eviews.com).
IV. Object Basics
At the heart of the EViews design is the concept of an object. In brief, objects are
collections of related information and operations that are bundled together into an
easy-to-use unit. Virtually all of your work in EViews will involve using and
manipulating various objects.
EViews holds all of its objects in object containers. You can think of object containers
as filing cabinets or organizers for the various objects with which you are working. The
most important object container in EViews is the workfile, which is described in
“Workfile Basics”.
The remainder of this chapter describes basic techniques for working with objects in
a workfile. While you may at first find the idea of objects to be a bit foreign, the basic
concepts are easy to master and will form the foundation for your work in EViews. But
don’t feel that you have to understand all of the concepts the first time through. If you
wish, you can begin working with EViews immediately, developing an intuitive
understanding of objects and workfiles as you go.
Subsequent chapters will provide a more detailed description of working with the
various types of objects and other types of object containers.
Note that the current discussion focuses on interactive methods for working with
objects. If you feel more comfortable using commands, “Object and Command
Basics”, offers command equivalents for the operations described in this chapter.
What is an Object?
Information in EViews is stored in objects. Each object consists of a collection of
information related to a particular area of analysis. For example, a series object is a
collection of information related to a set of observations on a particular variable. An
equation object is a collection of information related to the relationship between a
collection of variables.
Note that an object need not contain only one type of information. For example, an
estimated equation object contains not only the coefficients obtained from estimation
of the equation, but also a description of the specification, the variance-covariance
matrix of the coefficient estimates, and a variety of statistics associated with the
estimates.
Associated with each type of object is a set of views and procedures which can be
used with the information contained in the object. This association of views and
procedures with the type of data contained in the object is what we term the object
oriented design of EViews.
The object oriented design simplifies your work in EViews by organizing information
as you work. For example, since an equation object contains all of the information
relevant to an estimated relationship, you can move freely between a variety of
equation specifications simply by working with different equation objects. You can
examine results, perform hypothesis and specification tests, or generate forecasts at
any time. Managing your work is simplified since only a single object is used to work
with an entire collection of data and results.
This brief discussion provides only the barest introduction to the use of objects. The
remainder of this section will provide a more general description of EViews objects.
Subsequent chapters will discuss series, equations, and other object types in
considerable detail.
Object Data
Each object contains various types of information. For example, series, matrix, vector,
and scalar objects, all contain mostly numeric information. In contrast, equations and
systems contain complete information about the specification of the equation or
system, and the estimation results, as well as references to the underlying data used
to construct the estimates. Graphs and tables contain numeric, text, and formatting
information.
Since objects contain various kinds of data, you will want to work with different objects
in different ways. For example, you might wish to compute summary statistics for the
observations in a series, or you may want to perform forecasts based upon the results
of an equation. EViews understands these differences and provides you with custom
tools, called views and procedures, for working with an object’s data.
Object Views
There is more than one way to examine the data in an object. Views are tabular and
graphical windows that provide various ways of looking at the data in an object.
For example, a series object has a spreadsheet view, which shows the raw data, a
line graph view, a bar graph view, a histogram-and-statistics view, and a correlogram
view. Other views of a series include distributional plots, QQ-plots, and kernel density
plots. Series views also allow you to compute simple hypothesis tests and statistics
for various subgroups of your sample.
An equation object has a representation view showing the equation specification, an
output view containing estimation results, an actual-fitted-residual view containing
plots of fitted values and residuals, a covariance view containing the estimated
coefficient covariance matrix, and various views for specification and parameter tests.
Views of an object are displayed in the object’s window. Only one window can be
opened for each object and each window displays only a single view of the object at
a time. You can change views of an object using the View menu located in the object
window’s toolbar or the EViews main menu.
Perhaps the most important thing to remember about views is that views normally do
not change data outside the object. Indeed, in most cases, changing views only
changes the display format for the data, and not the data in the object itself.
Object Procedures
Most EViews objects also have procedures, or procs. Like views, procedures often
display tables or graphs in the object’s window. Unlike views, however, procedures
alter data, either in the object itself or in another object.
Many procedures create new objects. For example, a series object contains
procedures for smoothing or seasonally adjusting time series data and creating a new
series containing the smoothed or adjusted data. Equation objects contain procedures
for generating new series containing the residuals, fitted values, or forecasts from the
estimated equation.
You select procedures from the Proc menu on the object’s toolbar or from the EViews
main menu.
Object Types
The most common objects in EViews are series and equation objects. There are,
however, a number of different types of objects, each of which serves a unique
function. Most objects are represented by a unique icon which is displayed in the
object container (workfile or database) window. The basic object icons are given by:
Despite the fact that they are also objects, object containers do not have icons since
they cannot be placed in other object containers—thus, workfiles and databases do
not have icons since they cannot be placed in other workfiles or databases.
Note also that there are special icons that correspond to special versions of the
objects:
To create an object, you must first make certain that you have an open workfile
container and that its window is active. Next, select Object/New Object… from the
main menu. Until you have created or loaded a workfile, this selection is unavailable.
After you click on the Object/New Object… menu entry, you will see the New Object
dialog box.
You can click on the type of object you want, optionally provide a name for the object,
and then click on OK. For some object types, a second dialog box will open prompting
you to describe your object in more detail. For most objects, however, the object
window will open immediately.
For example, if you select Equation, you will see a dialog box prompting you for
additional information. Alternatively, if you click on Series and then select OK, you will
see an object window (series window) displaying the spreadsheet view of an
UNTITLED series.
We will discuss object windows in greater detail in “The Object Window”.
Objects can also be created by applying procedures to other objects or by freezing an
object view (see “Freezing Objects”).
Selecting Objects
Creating a new object will not always be necessary. Instead, you may want to work
with an existing object. One of the fundamental operations in EViews is selecting one
or more objects from the workfile directory.
The easiest way to select objects is to point-and-click, using the standard Windows
conventions for selecting contiguous or multiple items if necessary. Keep in mind that
if you are selecting a large number of items, you may find it useful to use the display
filter before beginning to select items.
In addition, the View button in the workfile toolbar provides convenient selection
shortcuts:
• Select All selects all of the objects in the workfile with the exception of the C
coefficient vector and the RESID series.
• Deselect All eliminates any existing selections.
Note that all of the selected objects will be highlighted.
Opening Objects
Once you have selected your object or objects, you will want to open your selection,
or create a new object containing the selected objects. You can do so by double
clicking anywhere in the highlighted area.
If you double click on a single selected object, you will open an object window.
If you select multiple graphs or series and double click, a pop-up menu appears, giving
you the option of creating and opening new objects (group, equation, VAR, graph) or
displaying each of the selected objects in its own window.
(You may also select View/Open Selected or right-mouse click and select Open to
access menus for opening the multiple objects.)
Note that if you select multiple graphs and double click or select View/Open
Selected/One Window, all of the graphs will be merged into a single graph and
displayed in a single window.
Other multiple item selections are not valid, and will either issue an error or will simply
not respond when you double click.
When you open an object, EViews will display the current view. In general, the current
view of an object is the view that was displayed the last time the object was opened
(if an object has never been opened, EViews will use a default view). The exception
to this general rule is for those views that require significant computational time. In this
latter case, the current view will revert to the default.
Showing Objects
An alternative method of selecting and opening objects is to “show” the item. Click on
the Show button on the toolbar, or select Quick/Show… from the menu and type in
the object name or names.
Showing an object works exactly as if you first selected the object or objects, and then
opened your selection. If you enter a single object name in the dialog box, EViews will
open the object as if you double clicked on the object name. If you enter multiple
names, EViews will always open a single window to display results, creating a new
object if necessary.
The Show button can also be used to display functions of series, also known as auto-
series. All of the rules for auto-series that are outlined in “Database Auto-Series” will
apply.
Previewing Objects
EViews offers a preview tool for those times when you wish to quickly look through a
number of objects. Instead of opening and closing each object, you may use the
preview to quickly scroll through a preview of each object, viewing metadata (name,
type, description, frequency, last update, source, units, etc.) and object type-specific
information (for example, series will show observation data and a small graph while
equations will show estimation output).
To preview an object you simply select the object in the workfile (or database), and, if
necessary, open the preview window. The preview window will display a preview of
the contents of the first selected object.
If the preview window is not open you may:
• Press the F9 key.
• Right-click on an object and select Preview or Preview members (the latter is only
be available for previewing group objects in a workfile).
• Select Window/Preview from the main menu.
Once opened, you may move the preview window anywhere on your screen, even
outside of the EViews application window. A subsequent press of the F9 key will
activate and bring to the front the preview window (if it is active) or close the preview
window (if the window is active).
The title bar of the preview window shows the type, name and location of the object,
and the number of objects in the current preview list (either the workfile or database,
or the currently selected subset of objects).
For example, here, we see a series preview window for the series CP which is located
in the workfile TESTFILE. CP is the second (alphabetically) of the 20 objects in this
workfile.
The top part of the display area shows the name of the object and possibly a
description, along with metafile information taken from the label view of the object.
The remaining contents of the window will differ depending on the selected object.
For the series object depicted here, the bottom area shows a spreadsheet of the
values in the series and a graph of the values in the series. Notice that you can interact
with the graph: change the display to show the levels of the series, or simple log,
percentage change, and year percentage change transforms of the data; click on
recent to change the graph to only show recent values of the series or all to show all
of the values in the series.
Alternately, the preview window for an equation as seen here displays the estimation
output in the bottom portion of the window.
Working with the Preview Window
To the right of the name or description at the top of the preview area are two icons:
• Lock: prevent the contents of the preview window from changing, even if you select
a different object. The preview window will remain locked until the lock button is
pressed again, therefore unlocking it.
• Find: bring the workfile or database window containing the object to forefront, and if
possible, select the object.
On the bottom right of the window, you will find two navigation buttons that facilitate
easy browsing through objects:
• >: navigate (forward) to the next object in the preview list, cycling around to the first
object if necessary.
• <: navigate (backward) to the previous object in the preview list, cycling around to
the last object if necessary.
If you select a single object, the list of objects to browse contains all of the objects in
the active database or workfile. Alternately, you can browse through a subset of
objects simply by selecting the objects of interest.
For group objects there is an additional navigation button in the lower right corner of
the preview window alongside the > and < buttons:
• Next 5>: navigate forward to the next five members of the group, cycling
around to the first object if necessary.
Note that the group preview lists all the members of a group under the Group Members
subwindow, but displays the line graphs of only five group members at a time. The
members displayed have colored line symbols before their names. If you click on a
group member in the list, the selection and graph will change. This member will be the
first of the five objects previewed in the graph.
For database objects, in the lower left corner of the preview window will contain an
Export button.
Pressing the Export button fetches the object shown in the preview window from the
database into the active workfile. If there is no open workfile, the object will be exported
to a new untitled workfile.
Clicking on the down arrow on the right side of the Export button shows two options:
Export and Export Special...
• Export will simply fetch the object into the current workfile as described above.
• Export Special... will display a dialog offering various options for the fetch operation.
You can control the workfile and page destination, whether to export series and alpha
objects as links or by (the default) copying of current values. Clicking on Export exports
only the currently displayed object. Clicking on Export All exports all selected objects.
Information in EViews is stored in objects. Each object consists of a collection of
information related to a particular area of analysis. For example, a series object is a
collection of information related to a set of observations on a particular variable. An
equation object is a collection of information related to the relationship between a
collection of variables.
Note that an object need not contain only one type of information. For example, an
estimated equation object contains not only the coefficients obtained from estimation
of the equation, but also a description of the specification, the variance-covariance
matrix of the coefficient estimates, and a variety of statistics associated with the
estimates.
Associated with each type of object is a set of views and procedures which can be
used with the information contained in the object. This association of views and
procedures with the type of data contained in the object is what we term the object
oriented design of EViews.
The object oriented design simplifies your work in EViews by organizing information
as you work. For example, since an equation object contains all of the information
relevant to an estimated relationship, you can move freely between a variety of
equation specifications simply by working with different equation objects. You can
examine results, perform hypothesis and specification tests, or generate forecasts at
any time. Managing your work is simplified since only a single object is used to work
with an entire collection of data and results.
This brief discussion provides only the barest introduction to the use of objects. The
remainder of this section will provide a more general description of EViews objects.
Subsequent chapters will discuss series, equations, and other object types in
considerable detail.
Object Data
Each object contains various types of information. For example, series, matrix, vector,
and scalar objects, all contain mostly numeric information. In contrast, equations and
systems contain complete information about the specification of the equation or
system, and the estimation results, as well as references to the underlying data used
to construct the estimates. Graphs and tables contain numeric, text, and formatting
information.
Since objects contain various kinds of data, you will want to work with different objects
in different ways. For example, you might wish to compute summary statistics for the
observations in a series, or you may want to perform forecasts based upon the results
of an equation. EViews understands these differences and provides you with custom
tools, called views and procedures, for working with an object’s data.
Object Views
There is more than one way to examine the data in an object. Views are tabular and
graphical windows that provide various ways of looking at the data in an object.
For example, a series object has a spreadsheet view, which shows the raw data, a
line graph view, a bar graph view, a histogram-and-statistics view, and a correlogram
view. Other views of a series include distributional plots, QQ-plots, and kernel density
plots. Series views also allow you to compute simple hypothesis tests and statistics
for various subgroups of your sample.
An equation object has a representation view showing the equation specification, an
output view containing estimation results, an actual-fitted-residual view containing
plots of fitted values and residuals, a covariance view containing the estimated
coefficient covariance matrix, and various views for specification and parameter tests.
Views of an object are displayed in the object’s window. Only one window can be
opened for each object and each window displays only a single view of the object at
a time. You can change views of an object using the View menu located in the object
window’s toolbar or the EViews main menu.
Perhaps the most important thing to remember about views is that views normally do
not change data outside the object. Indeed, in most cases, changing views only
changes the display format for the data, and not the data in the object itself.
Object Procedures
Most EViews objects also have procedures, or procs. Like views, procedures often
display tables or graphs in the object’s window. Unlike views, however, procedures
alter data, either in the object itself or in another object.
Many procedures create new objects. For example, a series object contains
procedures for smoothing or seasonally adjusting time series data and creating a new
series containing the smoothed or adjusted data. Equation objects contain procedures
for generating new series containing the residuals, fitted values, or forecasts from the
estimated equation.
You select procedures from the Proc menu on the object’s toolbar or from the EViews
main menu.
Object Types
The most common objects in EViews are series and equation objects. There are,
however, a number of different types of objects, each of which serves a unique
function. Most objects are represented by a unique icon which is displayed in the
object container (workfile or database) window. The basic object icons are given by:
Despite the fact that they are also objects, object containers do not have icons since
they cannot be placed in other object containers—thus, workfiles and databases do
not have icons since they cannot be placed in other workfiles or databases.
Note also that there are special icons that correspond to special versions of the
objects:
If you set a series object to be auto-updating (see “Auto-Updating Series”), EViews
will use the special icon to indicate that the series depends upon a formula. In contrast,
an auto-updating alpha series (which we imagine to be less common) uses the original
alpha icon, with an orange color to indicate the presence of a formula.
When group data are stored in databases, you will be given the option of storing the
group definition (list of series names) alone, or both the group definition and the series
contained in the group (see “Store, Fetch, and Copy of Group Objects”). If the latter
are stored, the standard group icon will be modified, with the “+” indicating the
additional presence of the series data.
Lastly, a link object (see “Series Links”), is always in one of three states, depending
upon the definition contained in the link. If the link is to a numeric source series, the
link object is displayed using a series icon, since it may be used as though it were an
ordinary series, with a distinctive pink color used to indicate that the object depends
on linked data. If the link is to an alpha source series, the link will show up as an alpha
series icon, again in pink. If, however, the link object is unable to locate the source
series, EViews will display the “?” icon indicating that the series type is unknown.
The Object Window
We have been using the term object window somewhat loosely in the previous
discussion of the process of creating and opening objects. Object windows are the
windows that are displayed when you open an object or object container. An object’s
window will contain either a view of the object, or the results of an object procedure.
One of the more important features of EViews is that you can display object windows
for a number of items at the same time. Managing these object windows is similar to
the task of managing pieces of paper on your desk.
Components of the Object Window
Let’s look again at a typical object window:
Here, we see the equation window for OLS_RESULTS. First, notice that this is a
standard window which can be closed, resized, minimized, maximized, and scrolled
both vertically and horizontally. As in other Windows applications, you can make an
object window active by clicking once on the titlebar, or anywhere in its window.
Making an object window active is equivalent to saying that you want to work with that
object. Active windows may be identified by the darkened titlebar.
Second, note that the titlebar of the object window identifies the object type, name,
and object container (in this case, the BONDS workfile or the OLS_RESULTS
equation). If the object is itself an object container, the container information is
replaced by directory information.
Lastly, at the top of the window there is a toolbar containing a number of buttons that
provide easy access to frequently used menu items. These toolbars will vary across
objects—the series object will have a different toolbar from an equation or a group or
a VAR object.
There are several buttons that are found on all object toolbars:
• The View button lets you change the view that is displayed in the object window.
The available choices will differ, depending upon the object type.
• The Proc button provides access to a menu of procedures that are available for the
object.
• The Object button lets you manage your objects. You can store the object on disk,
name, delete, copy, or print the object.
• The Print button lets you print the current view of the object (the window contents).
• The Name button allows you to name or rename the object.
• The Freeze button creates a new object graph, table, or text object out of the current
view.
Menus and the Object Toolbar
As we have seen, the toolbar provides a shortcut to frequently accessed menu
commands. There are a couple of subtle, but important, points associated with this
relationship that deserve special emphasis:
• Since the toolbar simply provides a shortcut to menu items, you can always find the
toolbar commands in the menus.
• This fact turns out to be quite useful if your window is not large enough to display all
of the buttons on the toolbar. You can either enlarge the window so that all of the
buttons are displayed, or you can access the command directly from the menu.
• The toolbar and menu both change with the object type. In particular, the contents
of the View menu and the Proc menu will always change to reflect the type of object
(series, equation, group, etc.) that is active.
The toolbars and menus differ across objects. For example, the View and Proc drop-
down menus differ for every object type. When the active window is displaying a series
window, the menus provide access to series views and series procedures.
Alternatively, when the active window is a group window, clicking on View or Proc in
the main menu provides access to the different set of items associated with group
objects.
The figure above illustrates the relationship between the View toolbar button and the
View menu when the series window is the active window. In the left side of the
illustration, we see a portion of the EViews main window, as it appears, after you click
on View in the main menu (note that the RC series window is the active window). On
the right, we see a depiction of the series window as it appears after you click on the
View button in the series toolbar. Since the two operations are identical, the two drop-
down menus are identical.
In contrast to the View and Proc menus, the Object menu does not, in general, vary
across objects. An exception occurs, however, when an object container window (i.e.,
a workfile or database window) is active. In this case, clicking on Object in the toolbar,
or selecting Object from the menu provides access to menu items for manipulating the
objects in the container.
Working with Objects
Naming Objects
Objects may be named or unnamed. When you give an object a name, the name will
appear in the directory of the workfile, and the object will be saved as part of the
workfile when the workfile is saved.
You must name an object if you wish to keep its results. If you do not name an object,
it will be called “UNTITLED”. Unnamed objects are not saved with the workfile, so they
are deleted when the workfile is closed and removed from memory.
To rename an object, first open the object window by double clicking on its icon, or by
clicking on Show on the workfile toolbar, and entering the object name. Next, click on
the Name button on the object window, and enter the name (up to 300 characters),
and optionally, a display name to be used when labeling the object in tables and
graphs. If no display name is provided, EViews will use the object name. Note: before
EViews 10, the maximum object name length was 24 characters. You may not be able
to correctly open a workfile with object names longer than 24 characters in previous
versions of EViews.
You can also rename an object from the workfile window by selecting Object/Rename
Selected… and then specifying the new object name. This method saves you from
first having to open the object.
The following names are reserved and cannot be used as object names: “ABS”,
“ACOS”, “AND”, “AR”, “ASIN”, “C”, “CON”, “CNORM”, “COEF”, “COS”, “D”, “DLOG”,
“DNORM”, “ELSE”, “ENDIF”, “EXP”, “LOG”, “LOGIT”, “LPT1”, “LPT2”, “MA”, “NA”,
“NOT”, “NRND”, “OR”, “PDL”, “RESID”, “RND”, “SAR”, “SIN”, “SMA”, “SQR”, and
“THEN”.
EViews accepts both capital and lower case letters in the names you give to your
series and other objects, but does not distinguish between names based on case. Its
messages to you will follow normal capitalization rules. For example, “SALES”, “sales”,
and “sAles” are all the same object in EViews. For the sake of uniformity, we have
written all examples of input using names in lower case, but you should feel free to
use capital letters instead.
Despite the fact that names are not case sensitive, when you enter text information in
an object, such as a plot legend or label information, your capitalization will be
preserved.
By default, EViews allows only one untitled object of a given type (one series, one
equation, etc.). If you create a new untitled object of an existing type, you will be
prompted to name the original object, and if you do not provide one, EViews will
replace the original untitled object with the new object. The original object will not be
saved. If you prefer, you can instruct EViews to retain all untitled objects during a
session but you must still name the ones you want to save with the workfile. See
“Window Behavior”.
Labeling Objects
In addition to the display name described above, EViews objects have label fields
where you can provide extended annotation and commentary. To view these fields,
select View/Label from the object window:
This is the label view of an unmodified object. By default, every time you modify the
object, EViews automatically appends the modification in the Last Update field.
You can edit any of the fields, except Last Update. Simply click in the cell that you
want to edit. All attributes contain only one line, except the Remarks field, which can
contain multiple lines. Press ENTER after entering data into the current field to add a
new line to this attribute.
These annotated fields are useful when you want to search for an object stored in an
EViews database. Any text that is in the fields is searchable in an EViews database;
see “Querying the Database” for further discussion.
Adding Custom Attributes in the Label View
EViews allows you to add any custom attribute that you’d like to your objects. Click in
the empty cell below the last existing attribute, and before the Remarks label. You will
see the text “Enter attribute name” in the edit field at the top of the window. Enter the
name of your new custom attribute, and then move to the cell to the right to enter a
value.
In our example, click below Units. Enter the name of the new attribute, and type the
appropriate value in the field to the right. Here, we have created a custom attribute
called Default Rate, and entered the value “6.23%”. Close the object window to accept
the changes.
You must type something into the associated field on the right, or the custom attribute
will not be saved when the object window is closed. To add an attribute whose data
will be filled out in the future, you may want to enter “none” as a placeholder. However,
adding custom attributes is easy, either via the label view as just described, or in the
workfile window (see “Adding Your Own Label Attributes”), so this step should not be
necessary.
Similarly, you can delete an attribute by removing its value. If we delete “6.23%” in our
example and close the window, the Default Rate attribute will be removed from the
object.
If you are adding custom attributes to many objects, EViews provides tools for doing
so in the workfile window. See “Adding Your Own Label Attributes”. From the workfile
Details view, you can add attributes across multiple objects, and populate them with
values using workfile filtering techniques.
Copying Objects
There are two distinct methods of duplicating the information in an object: copying and
freezing.
If you select Object/Copy from the menu, EViews will create a new untitled object
containing an exact copy of the original object. By exact copy, we mean that the new
object duplicates all the features of the original (except for the name). It contains all of
the views and procedures of the original object and can be used in future analyses
just like the original object.
You may also copy an object from the workfile window. Simply highlight the object and
click on Object/Copy Selected… or right mouse click and select Object/Copy..., then
specify the destination name for the object.
We mention here that Copy is a very general and powerful operation with many
additional features and uses. For example, you can copy objects across both workfiles
and databases using wildcards and patterns. See “Copying Objects” for details on
these additional features.
Copy-and-Pasting Objects
The standard EViews copy command makes a copy of the object in the same workfile.
When two workfiles are in memory at the same time, you may copy objects between
them using copy-and-paste.
Highlight the objects you wish to copy in the source workfile. Then select Edit/Copy
from the main menu.
Select the destination workfile by clicking on its titlebar. Then select either Edit/Paste
or Edit/Paste Special... from the main menu or simply Paste or Paste Special...
following a right mouse click.
Edit/Paste will perform the default paste operation. For most objects, this involves
simply copying over the entire object and its contents. In other cases, the default paste
operation is more involved. For example, when copy-and-pasting series between
source and destination workfiles that are of different frequency, frequency conversion
will be performed, if possible, using the default series settings (see “Frequency
Conversion” for additional details). EViews will place named copies of all of the
highlighted objects in the destination workfile, prompting you to replace existing
objects with the same name.
If you elect to Paste Special..., EViews will open a dialog prompting you for any
relevant paste options. For example, when pasting series, you may use the dialog to
override the default series settings for frequency conversion, to perform special match
merging by creating links (“Series Links”). In other settings, Paste Special... will simply
prompt you to rename the objects in the destination workfile.
Freezing Objects
The second method of copying information from an object is to freeze a view of the
object. If you click Object/Freeze Output or press the Freeze button on the object’s
toolbar, a table or graph object is created that duplicates the current view of the original
object.
Before you press Freeze, you are looking at a view of an object in the object window.
Freezing the view makes a copy of the view and turns it into an independent object
that will remain even if you delete the original object. A frozen view does not
necessarily show what is currently in the original object, but rather shows a snapshot
of the object at the moment you pushed the button. For example, if you freeze a
spreadsheet view of a series, you will see a view of a new table object; if you freeze a
graphical view of a series, you will see a view of a new graph object.
Frozen graphs are a bit more sophisticated than other frozen objects. While frozen
tables do not change when the workfile sample or data change, you may select if and
when a frozen graph should update as the sample or its underlying data change. You
may treat a frozen graph as a snapshot of the data at the time it was frozen, or update
it at will. For a complete discussion of graph updating, see “Freezing a Graph View”.
The primary feature of freezing an object is that the tables and graphs created by
freezing may be edited for presentations or reports. Many options for customization
are only available for frozen objects or may be deleted when the object is refreshed,
so you should be sure to freeze an object before customizing it.
Deleting Objects
To delete an object or objects from your workfile, select the object or objects in the
workfile directory. When you have selected everything you want to delete, click Delete
or Object/Delete Selected on the workfile toolbar. EViews will prompt you to make
certain that you wish to delete the objects.
Printing Objects
To print the currently displayed view of an object, push the Print button on the object
window toolbar. You can also choose File/Print or Object/Print on the main EViews
menu bar.
EViews will open a Print dialog containing the default print settings for the type of
output you are printing. Here, we see the dialog for printing text information; the dialog
for printing from a graph will differ slightly.
The default settings for printer type, output redirection, orientation, and text size may
be set in the Print Setup... dialog (see “Print Setup”) or they may be overridden in the
current print dialog.
For example, the print commands normally send a view or procedure output to the
current Windows printer. You may specify instead that the output should be saved in
the workfile as a table or graph, spooled to an RTF or ASCII text file on disk, sent to a
spool object. or CSV file. Simply click on Redirect, then select the output type from the
list.
The “(graphs print)” in the entries indicates that graphs will still be sent to the printer
since the specified redirect type does not support graph output.
Storing Objects
EViews provides three ways to save your data on disk. You have already seen how to
save entire workfiles, where all of the objects in the workfile are saved together in a
single file with the “.WF1” extension. You may also store individual objects in their own
data bank files. They may then be fetched into other workfiles.
We will defer a full discussion of storing objects to data banks and databases until
“EViews Databases”. For now, note that when you are working with an object, you can
place it in a data bank or database file by clicking on the Object/Store to DB… button
on the object's toolbar or menu. EViews will prompt you for additional information.
You can store several objects, by selecting them in the workfile window and then
pressing the Object/Store selected to DB… button on the workfile toolbar or menu.
Fetching Objects
You can fetch previously stored items from a data bank or database. One of the
common methods of working with data is to create a workfile and then fetch previously
stored data into the workfile as needed.
To fetch objects into a workfile, select Object/Fetch from DB… from the workfile menu
or toolbar. You will see a dialog box prompting you for additional information for the
fetch: objects to be fetched, directory and database location, as applicable.
See “Fetching Objects from the Database” for details on the advanced features of the
fetch procedure.
Updating Objects
Updating works like fetching objects, but requires that the objects be present in the
workfile. To update objects in the workfile, select them from the workfile window, and
click on Object/Update from DB… from the workfile menu or toolbar. The Fetch dialog
will open, but with the objects to be fetched already filled in. Simply specify the
directory and database location and click OK.
The selected objects will be replaced by their counterparts in the data bank or
database.
See “Fetching Objects from the Database” and “Database Auto-Series” for additional
details.
Copy-and-Paste of Object Information
You can copy the list of object information displayed in a workfile or database window
to the Windows clipboard and paste the list to other program files such as word
processing files or spreadsheet files. Simply highlight the objects in the workfile
directory window, select Edit/Copy (or click anywhere in the highlighted area, with the
right mouse button, and select Copy). Then move to the application (word processor
or spreadsheet) where you want to paste the list, and select Edit/Paste.
If only object names and icons are displayed in the window, EViews will copy a single
line containing the highlighted names to the clipboard, with each name separated by
a space. If the window contains additional information, either because View/Display
Comments (Label+/–) has been chosen in a workfile window or a query has been
carried out in a database window, each name will be placed in a separate line along
with the additional information.
Note that if you copy-and-paste the list of objects into another EViews workfile, the
objects themselves will be copied.
Basic Data Handling
The process of entering, reading, editing, manipulating, and generating data forms the
foundation of most data analyses. Accordingly, much of your time in EViews will
probably be spent working with data. EViews provides you with a sophisticated set of
data manipulation tools that make these tasks as simple and straightforward as
possible.
This chapter describes the fundamentals of working with data in EViews. There are
three cornerstones of data handling in EViews: the two most common data objects,
series and groups, and the use of samples which define the set of observations in the
workfile that we wish to use in analysis.
We begin our discussion of data handling with a brief description of series, groups,
and samples, and then discuss the use of these objects in basic input, output, and
editing of data. Lastly, we describe the basics of frequency conversion.
In “Working with Data”, we discuss the basics of EViews’ powerful language for
generating and manipulating the data held in series and groups. Subsequent chapters
describe additional techniques and objects for working with data.
V. Basic Data Handling
The process of entering, reading, editing, manipulating, and generating data forms the
foundation of most data analyses. Accordingly, much of your time in EViews will
probably be spent working with data. EViews provides you with a sophisticated set of
data manipulation tools that make these tasks as simple and straightforward as
possible.
This chapter describes the fundamentals of working with data in EViews. There are
three cornerstones of data handling in EViews: the two most common data objects,
series and groups, and the use of samples which define the set of observations in the
workfile that we wish to use in analysis.
We begin our discussion of data handling with a brief description of series, groups,
and samples, and then discuss the use of these objects in basic input, output, and
editing of data. Lastly, we describe the basics of frequency conversion.
In “Working with Data”, we discuss the basics of EViews’ powerful language for
generating and manipulating the data held in series and groups. Subsequent chapters
describe additional techniques and objects for working with data.
Data Object
The process of entering, reading, editing, manipulating, and generating data forms the
foundation of most data analyses. Accordingly, much of your time in EViews will
probably be spent working with data. EViews provides you with a sophisticated set of
data manipulation tools that make these tasks as simple and straightforward as
possible.
This chapter describes the fundamentals of working with data in EViews. There are
three cornerstones of data handling in EViews: the two most common data objects,
series and groups, and the use of samples which define the set of observations in the
workfile that we wish to use in analysis.
We begin our discussion of data handling with a brief description of series, groups,
and samples, and then discuss the use of these objects in basic input, output, and
editing of data. Lastly, we describe the basics of frequency conversion.
In “Working with Data”, we discuss the basics of EViews’ powerful language for
generating and manipulating the data held in series and groups. Subsequent chapters
describe additional techniques and objects for working with data.
The actual numeric values that make up your data will generally be held in one or
more of EViews’ data objects (series, groups, matrices, vectors, and scalars). For
most users, series and groups will by far be the most important objects, so they will
be the primary focus of our discussion. Matrices, vectors, and scalars are discussed
at greater length in “Matrix Language”.
The following discussion is intended to provide only a brief introduction to the basics
of series and groups. Our goal is to describe the fundamentals of data handling in
EViews. An in-depth discussion of series and group objects follows in subsequent
chapters.
Series
An EViews series contains a set of observations on a numeric variable. Associated
with each observation in the series is a date or observation label. For series in regularly
dated workfiles, the observations are presumed to be observed regularly over time.
For undated data, the observations are not assumed to follow any particular
frequency.
Note that the series object may only be used to hold numeric data. If you wish to work
with alphanumeric data, you should employ alpha series. See “Alpha Series” for
discussion.
Creating a series
One method of creating a numeric series is to select Object/New Object… from the
menu, and then to select Series. You may, at this time, provide a name for the series,
or you can let the new series be untitled. Click on OK.
EViews will open a spreadsheet view of the new series object. All of the observations
in the series will be assigned the missing value code “NA”. You may then edit or use
expressions to assign values for the series.
You may also use the New Object dialog to create alpha series. Alpha series are
discussed in greater detail in “Alpha Series”.
A second method of creating a series is to generate the series using mathematical
expressions. Click on Quick/Generate Series… in the main EViews menu, and enter
an expression defining the series. We will discuss this method in depth in the next
chapter.
Lastly, you may create the numeric or alpha series by entering a series or alpha
command in the command window. Entering an expression of the form:
series series_name = series_expr
creates a series with the name series_name and assigns the expression to each
observaton. Alternately:
alpha alpha_name = alpha_expr
creates an alpha series object and assigns the alpha_expr to each observation.
You may leave out the right-hand side assignment portion of the commands; in this
case, the series or alpha will be initialized to missing values (NA and blank strings,
respectively).
Changing the Spreadsheet Display
EViews provides you with extensive ability to customize your series spreadsheet
display.
Column Widths
To resize the width of a column, simply move your mouse over the column separator
until the icon changes, then drag the column to its desired width. The new width will
be remembered the next time you open the series and will be used when the series is
displayed in a group spreadsheet.
Display Type
The series display type, which is listed in the dropdown menu in the series toolbar,
determines how the series spreadsheet window shows your data.
The Default method shows data in either raw (underlying data) form or, if a value map
is attached to the series, shows the mapped values. Alternatively, you may use the
Raw Data to show only the underlying data. See “Value Maps” for a description of the
use of value maps.
You may also use the display type setting to show transformations of the data. You
may, for example, set the display method to Differenced, in order to have EViews
display the first-differences of your data.
Changing the display of your series values does not alter the underlying values in the
series, it only modifies the values shown in the spreadsheet (the series header,
located above the labels, will also change to indicate the transformation). Note,
however, that if you edit the values of your series while displayed in transformed mode,
EViews will change the underlying values of the series accordingly. Changing the
display and editing data in transformed mode is a convenient method of inputting data
that arrive as changes or other transformed values.
Display Formats
You may customize the way that numbers or characters in your series are displayed
in the spreadsheet by setting the series display properties. To display the dialog, click
on Properties in the series toolbar, or right mouse click and select the Display Format...
entry in the menu to display the first tab of the dialog.
EViews will open the Properties dialog with the Display tab selected. You may use this
dialog to change the default column width and justification for the series, and to choose
from a large list of numeric display formats for data displayed using the different
display types.
The Data displayed as dropdown menu is used to select the display type to which the
current Numeric display settings will apply. There are a different set of numeric
settings for each type.
You may, for example, elect to change the display of numbers to show additional
digits, to separate thousands with a comma, or to display numbers as fractions. The
last four items in the Numeric display dropdown menu provide options for the
formatting of date number.
Similarly, you may elect to change the series justification by selecting Auto, Left,
Center, or Right. Note that Auto justification will set justification to right for numeric
series, and left for alpha series.
You may also use this dialog to change the column width (note that column widths in
spreadsheets may also be changed interactively by dragging the column headers).
Once you click on OK, EViews will accept the current settings and change the
spreadsheet display to reflect your choices. In addition, these display settings will be
used whenever the series spreadsheet is displayed or as the default settings when
the series is used in a group spreadsheet display.
Note that when you apply a display format, you may find that a portion of the contents
of a cell are not visible, when, for example, the column widths are too small to show
the entire cell. Alternately, you may have a numeric cell for which the current display
format only shows a portion of the full precision value.
In these cases, it may be useful to examine the actual contents of a table cell. To do
so, simply select the table cell. The unformatted contents of the cell will appear in the
status line at the bottom of the EViews window.
Sorting a Series
The data in a series may be displayed sorted by observation or by the values in the
series. You may change the order in which observations are displayed in the
spreadsheet by clicking on the sort button and filling out the dialog. Note that this
display sorting does not change the underlying order of the observations in the
workfile.
You may press the Sort button on the button bar or by click on the right-mouse button
and select Sort from the menu. To sort by series value, the entire series must be
selected. To select the series, simply press the column header directly above the
series values. Similarly, to sort by observation, the observation column must be
selected.
If only a subset of the entire data series or observation series is selected, the Sort
menu item will not be available.
Narrow versus Wide
The narrow display displays the observations for the series in a single column, with
date labels in the margin. The typical series spreadsheet display will use this display
format.
The wide display arranges the observations from left to right and top to bottom, with
the label for the first observation in the row displayed in the margin. For dated
workfiles, EViews will, if possible, arrange the data in a form which matches the
frequency of the data. Thus, semi-annual data will be displayed with two observations
per row, quarterly data will contain four observations per row, and 5-day daily data will
contain five observations in each row.
You can change the display to show the observations in your series in multiple
columns by clicking on the Wide +/- button on the spreadsheet view toolbar (you may
need to resize the series window to make this button visible). For example, toggling
the Wide +/- button switches the display between the wide display (as depicted), and
the narrow (single column) display.
This wide display format is useful when you wish to arrange observations for a
particular season in each of the columns.
Observation Numbers
If you wish to modify the observation labels to include an observation number, right-
click and select ObsID +/-. Selecting ObsID +/- switches the display between showing
a label that includes the observation label and one which does not. This feature is
useful if you wish to identify the observation number of a particular observation.
Sample Subset Display
By default, all observations in the workfile are displayed, even those observations not
in the current sample. By pressing Smpl +/– you can toggle between showing all
observations in the workfile, and showing only those observations included in the
current sample.
There are two features that you should keep in mind as you toggle between the various
display settings:
• If you choose to display only the observations in the current sample, EViews will
switch to single column display.
• If you switch to wide display, EViews automatically turns off the display filter so that
all observations in the workfile are displayed.
One consequence of this behavior is that if you begin with a narrow display of
observations in the current sample, click on Wide +/- to switch to wide display, and
then press the Wide +/- button again, EViews will provide a narrow display of all of the
observations in the workfile. To return to the original narrow display of the current
sample, you will need to press the Smpl +/- button again.
Live statistics
The series and group spreadsheet views now display interactive statistics. When a
spreadsheet is first opened the statistics are computed using all of the data in the
spreadsheet.
Double-clicking on the bottom bar brings up a menu where the statistics shown can
be changed. A maximum of six statistics may be displayed at once. The window may
need to be resized to display all the statistics.
Editing a series
You can edit individual values of the data in a series.
First, open the spreadsheet view of the series. If the series window display does not
show the spreadsheet view, click on the Sheet button, or select View/Spreadsheet, to
change the default view.
Next, make certain that the spreadsheet window is in edit mode. EViews provides you
with the option of protecting the data in your series by turning off the ability to edit from
the spreadsheet window. You can use the Edit +/– button on the toolbar to toggle
between edit mode and protected mode.
Here we see a series spreadsheet window in edit mode. Notice the presence of the
edit window just beneath the series toolbar containing the value of RC in 1953M01,
and the box around the selected cell in the spreadsheet; neither are present in
protected mode.
To change the value for an observation, select the cell, type in the value, and press
ENTER. For example, to change the value of RC in 1953M01, simply click on the cell
containing the value, type the new value in the edit window, and press ENTER.
When editing series values, you should pay particular attention to the series display
format, which tells you the units in which your series are displayed. Here, we see that
the series values are displayed in Default mode so that you are editing the underlying
series values (or their value mapped equivalents). Alternately, if the series were
displayed in Differenced mode, then the edited values correspond to the first
differences of the series.
Note that some cells in the spreadsheet are protected. For example, you may not edit
the observation labels, or the “Last update” series label. If you select one of the
protected cells, EViews will display a message in the edit window telling you that the
cell cannot be edited.
When you have finished editing, you should protect yourself from inadvertently
changing values of your data by clicking on Edit +/– to turn off edit mode.
Advanced tools for editing series values are described in “Series Adjust”.
Inserting and Deleting Observations in a Series
You can also insert and delete observations in the series. First, click on the cell where
you want the new observation to appear. Next, right click and select Insert obs... or
Delete obs... from the menu. You will see a dialog asking how many observations you
wish to insert or delete at the current position.
If you choose to insert a single observation, EViews will insert a missing value at the
appropriate position and push all of the observations down so that the last observation
will be lost from the workfile. If you wish to preserve this observation, you will have to
expand the workfile before inserting observations. If you choose to delete an
observation, all of the remaining observations will move up, so that you will have a
missing value at the end of the workfile range.
Groups
When working with multiple series, you will often want to create a group object to help
you manage your data. A group is a list of series names (and potentially, mathematical
expressions) that provides simultaneous access to all of the elements in the list.
With a group, you can refer to sets of variables using a single name. Thus, a set of
variables may be analyzed, graphed, or printed using the group object, rather than
each one of the individual series. Therefore, groups are often used in place of entering
a lengthy list of names. Once a group is defined, you can use the group name in many
places to refer to all of the series contained in the group.
You will also create groups of series when you wish to analyze or examine multiple
series at the same time. For example, groups are used in computing correlation
matrices, testing for cointegration and estimating a VAR or VEC, and graphing series
against one another.
Creating Groups
There are several ways to create a group. Perhaps the easiest method is to select
Object/New Object… from the main menu or workfile toolbar, click on Group, and if
desired, name the object.
You should enter the names of the series to be included in the group, separated by
spaces, and then click OK.
You may use the wildcard characters “*” and “?” to match more than one series in the
workfile, and you may use the keywords “and” and “not” to specify that certain items
should be excluded from the group.
A group window will open showing a spreadsheet view of the group.
You may have noticed that the dialog allows you to use group names and series
expressions. If you include a group name, all of the series in the named group will be
included in the new group. For example, suppose that the group GR1 contains the
series X, Y, and Z, and you create a new group GR2, which contains GR1 and the
series A and B. Then GR2 will contain X, Y, Z, A and B. Bear in mind that only the
series contained in GR1, not GR1 itself, are included in GR2; if you later add series to
GR1, they will not be added to GR2.
Series expressions will be discussed in greater depth later. For now, it suffices to note
that series expressions are mathematical expressions that may involve one or more
series (e.g. “7/2” or “3*X*Y/Z”). EViews will automatically evaluate the expressions for
each observation and display the results as if they were an ordinary series. Users of
spreadsheet programs will be familiar with this type of automatic recalculation.
Here, for example, is a spreadsheet view of an untitled group containing the series
RC, a series expression for the lag of RG, RG(–1), and a series expression involving
RC and RG.
Notice here the Default setting for the group spreadsheet display indicates that the
series RC and RG(-1) are displayed using the original values, spreadsheet types, and
formats set in the original series (see “Display Formats”). A newly created group
always uses the Default display setting, regardless of the settings in the original series,
but the group does adopt the original series cell formatting. You may temporarily
override the display setting by selecting a group display format. For example, to use
the display settings of the original series, you should select Series Spec; to display
differences of all of the series in the group, select Differenced.
An equivalent method of creating a group is to select Quick/Show…, or to click on the
Show button on the workfile toolbar, and then to enter the list of series, groups and
series expressions to be included in the group. This method differs from using
Object/New Object… only in that it does not allow you to name the object at the time
it is created.
You can also create an empty group that may be used for entering new data from the
keyboard or pasting data copied from another Windows program. These methods are
described in detail in “Entering Data” and “Copying-and-Pasting”.
Editing in a Group
Editing data in a group is similar to editing data in a series. Open the group window,
and click on Sheet, if necessary, to display the spreadsheet view. If the group
spreadsheet is in protected mode, click on Edit +/– to enable edit mode, then select a
cell to edit, enter the new value, and press ENTER. The new number should appear
in the spreadsheet.
Since groups are simply references to series, editing the series within a group changes
the values in the original series.
As with series spreadsheet views, you may click on Smpl +/– to toggle between
showing all of the observations in the workfile and showing only those observations in
the current sample. Unlike the series window, the group window always shows series
in a single column.
Note that while groups inherit many of the series display formats when they are
created, to reduce confusion, groups do not initially show transformed values of the
series. If you wish to edit a series in a group in transformed form, you must explicitly
set a transformation type for the group display.
Adding to or Modifying a Group
You can add to or modify an existing group by clicking on View/Group Members and
then editing the list of names. Clicking on the UpdateGroup accepts your edits (see
“Group Members” for details).
Alternately, you can drag-and-drop series into the Group Members or Spreadsheet
views of the group EViews will automatically add the series to the group.
Samples
One of the most important concepts in EViews is the sample of observations. The
sample is the set (often a subset) of observations in the workfile to be included in data
display and in performing statistical procedures. Samples may be specified using
ranges of observations and “if conditions” that observations must satisfy to be
included.
For example, you can tell EViews that you want to work with observations from
1953M1 to 1970M12 and 1995M1 to 1996M12. Or you may want to work with data
from 1953M1 to 1958M12 where observations in the RC series exceed 3.6.
The remainder of this discussion describes the basics of using samples in non-panel
workfiles. For a discussion of panel samples, see “Panel Samples”
The Workfile Sample
When you create a workfile, the workfile sample or global sample is set initially to be
the entire range of the workfile. The workfile sample tells EViews what set of
observations you wish to use for subsequent operations. Unless you want to work with
a different set of observations, you will not need to reset the workfile sample.
You can always determine the current workfile sample of observations by looking at
the top of your workfile window.
Here the BONDS workfile consists of 528 observations from January 1953 to
December 1996. The current workfile sample uses a subset of those observations
consisting of the 45 observations between 1953M01 and 1958M12 for which the value
of the RC series exceeds 3.6.
Changing the Sample
There are four ways to set the workfile sample: you may click on the Sample button in
the workfile toolbar, you may double click on the sample string display in the workfile
window, you can select Proc/Set Sample… from the main workfile menu, or you may
enter a smpl command in the command window. If you use one of the interactive
methods, EViews will open the Sample dialog prompting you for input.
Date Pairs
In the upper edit field you will enter one or more pairs of dates (or observation
numbers). Each pair identifies a starting and ending observation for a range to be
included in the sample.
For example, if, in an annual workfile, you entered the string “1950 1980 1990 1995”,
EViews will use observations for 1950 through 1980 and observations for 1990
through 1995 in subsequent operations; observations from 1981 through 1989 will be
excluded. For undated data, the date pairs correspond to observation identifiers such
as “1 50” for the first 50 observations.
You may enter your date pairs in a frequency other than that of the workfile. Dates
used for the starts of date pairs are rounded down to the first instance of the
corresponding date in the workfile frequency, while dates used for the ends of date
pairs are rounded up to the last instance of the corresponding date in the workfile
frequency. For example, the date pair “1990m1 2002q3” in an annual workfile will be
rounded to “1990 2002”, while the date pair “1/30/2003 7/20/2004” in a quarterly
workfile will be rounded to “2003q1 2004q3”.
For intraday data, the sample may be further specified by including a time after the
start and end dates. For example, given an hourly workfile, entering “1/3/2000 10AM
12/30/2000 2PM” will limit the start time to 10AM on 1/3/2000 and to 2PM on
12/30/2000.
EViews provides special keywords that may make entering sample date pairs easier.
First, you can use the keyword “@ALL”, to refer to the entire workfile range. In the
workfile above, entering “@ALL” in the dialog is equivalent to entering “1953M1
1996M12”. Furthermore, you may use “@FIRST” and “@LAST” to refer to the first and
last observation in the workfile. Thus, the three sample specifications for the above
workfile:
@all
@first 1996m12
1953m1 @last
are identical.
Note that when interpreting sample specifications involving days, EViews will, if
necessary, use the global defaults (“Date Representation”) to determine the correct
ordering of days, months, and years. For example, the order of the months and days
is ambiguous in the date pair:
1/3/91 7/5/95
so EViews will use the default date settings to determine the desired ordering. We
caution you, however, that using the default settings to disambiguate dates in samples
is not generally a good idea since a given pair may be interpreted in different ways at
different times if your settings change.
Alternately, you may use the IEEE standard format, “YYYY-MM-DD”, which uses a
four-digit year, followed by a dash, a two-digit month, a second dash, and a two-digit
day. The presence of a dash in the format means that you must enclose the date in
quotes for EViews to accept this format. For example:
"1991-01-03" "1995-07-05"
will always be interpreted as January 3, 1991 and July 5, 1995. See “Free-format
Conversion Details” for related discussion.
Sample IF conditions
The lower part of the sample dialog allows you to add conditions to the sample
specification. The sample is the intersection of the set of observations defined by the
range pairs in the upper window and the set of observations defined by the “if”
conditions in the lower window. For example, if you enter:
Upper window: 1980 1993
Lower window: incm > 5000
the sample includes observations for 1980 through 1993 where the series INCM is
greater than 5000.
Similarly, if you enter:
Upper window: 1958q1 1998q4
Lower window: gdp > gdp(-1)
all observations from the first quarter of 1958 to the last quarter of 1998, where GDP
has risen from the previous quarter, will be included.
The “or” and “and” operators allow for the construction of more complex expressions.
For example, suppose you now wanted to include in your analysis only those
individuals whose income exceeds 5000 dollars per year and who have at least 13
years of education. Then you can enter:
Upper window: @all
Lower window: income > 5000 and educ >= 13
Multiple range pairs and “if” conditions may also be specified:
Upper window: 50 100 200 250
Lower window: income >= 4000 and educ > 12
includes undated workfile observations 50 through 100 and 200 through 250, where
the series INCOME is greater than or equal to 4000 and the series EDUC is greater
than 12.
You can create even more elaborate selection rules by including EViews built-in
functions:
Upper window: 1958m1 1998m1
Lower window: (ed>=6 and ed<=13) or earn<@mean(earn)
includes all observations where the value of the variable ED falls between 6 and 13,
or where the value of the variable EARN is lower than its mean. Note that you may
use parentheses to group the conditions and operators when there is potential
ambiguity in the order of evaluation.
It is possible that one of the comparisons used in the conditioning statement will
generate a missing value. For example, if an observation on INCM is missing, then
the comparison INCM>5000 is not defined for that observation. EViews will treat such
missing values as though the condition were false, and the observation will not be
included in the sample.
Sample Commands
You may find it easier to set your workfile sample from the command window—instead
of using the dialog, you may set the active sample using the smpl command. Simply
click on the command window to make it active, and type the keyword “SMPL”,
followed by the sample string:
smpl 1955m1 1958m12 if rc>3.6
and then press ENTER (notice, in the example above, the use of the keyword “IF” to
separate the two parts of the sample specification). You should see the sample
change in the workfile window.
Samples for Intraday data
When your data is specified in a frequency higher than a day, you may use IF
conditions to set the sample to include specific hours over multiple days. Four
functions in EViews facilitate this: @hour, @minute, @second, and @hourf.
Suppose you have minute data over all 24 hours and would like to set the sample to
only include 9:30AM to 2:30PM. This can be accomplished using the @hourf
command, which returns the observation time as a floating point hour:
smpl if @hourf>=9.5 and @hourf<=14.5
To select only observations that appear on the half hour, use the @minute command:
smpl if @minute=0 or @minute=30
To select only observations that are on Mondays at 10AM:
smpl if @weekday=1 and @hourf=10
Sample Offsets
Sample range elements may contain mathematical expressions to create date offsets.
This feature can be particularly useful in setting up a fixed width window of
observations. For example, in the regular frequency monthly workfile above, the
sample string:
1953m1 1953m1+11
defines a sample that includes the 12 observations in the calendar year beginning in
1953M1.
While EViews expects date offsets that are integer values, there is nothing to stop you
from adding or subtracting non-integer values—EViews will automatically convert the
number to an integer. You should be warned, however, that the conversion behavior
is not guaranteed to be well-defined. If you must use non-integer values, you are
strongly encouraged to use the @round, @floor or @ceil functions to enforce the
desired behavior.
The offsets are perhaps most useful when combined with the special keywords to trim
observations from the beginning or end of the sample. For example, to drop the first
observation in your sample, you may use the sample statement:
smpl @first+1 @last
Accordingly, the following commands generate a series containing cumulative sums
of the series X in XSUM:
smpl @first @first
series xsum = x
smpl @first+1 @last
xsum = xsum(-1) + x
(see “Basic Assignment”). The first two commands initialize the cumulative sum for
the first observation in each cross-section. The last two commands accumulate the
sum of values of X over the remaining observations.
Similarly, if you wish to estimate your equation on a subsample of data and then
perform cross-validation on the last 20 observations, you may use the sample defined
by,
smpl @first @last-20
to perform your estimation, and the sample,
smpl @last-19 @last
to perform your forecast evaluation.
While the use of sample offsets is generally straightforward, there are a number of
important subtleties to note when working with irregular dated data and other
advanced workfile structures (“Advanced Workfiles”). To understand the nuances
involved, note that there are three basic steps in the handling of date offsets.
First, dates used for the starts of date pairs are rounded down to the first instance of
the corresponding date in the workfile regular frequency, while dates used for the ends
of date pairs are rounded up to the last instance of the corresponding date in the
regular frequency. If date pairs are specified in the workfile frequency (e.g., the pair
“1990 2000” is used in an annual workfile), this step has no effect.
Next, EViews examines the workfile frequency date pair to determine whether the
sample dates fall within the range of the observed dates in the workfile, or whether
they fall outside the observed date range. The behavior of sample offsets differs in the
two cases.
For simplicity of discussion, assume first that both dates fall within the range of
observed dates in the workfile. In this case:
• EViews identifies base observations consisting of the earliest and latest workfile
observations falling within the date pair range.
• Offsets to the date pair are then applied to the base observations by moving through
the workfile observations. If, for example, the offset for the first element of a date pair
is “+1”, then the sample is adjusted so that it begins with the observation following the
base start observation. Similarly, if the offset for the last element of a date pair is “-2”,
then the sample is adjusted to end two observations prior to the base end observation.
Next, we assume that both dates fall outside the range of observed workfile dates. In
this setting:
• EViews applies offsets to the date pair outside of the workfile range using the regular
frequency until the earliest and latest workfile dates are reached. The base
observations are then set to the earliest and latest workfile observations.
• Any remaining offsets are applied to the base observations by moving through the
workfile observations, as in the earlier case.
The remaining two cases, where one element of the pair falls within, and the other
element falls outside the workfile date range, follow immediately.
It is worth pointing out that the difference in behavior is not arbitrary. It follows from
the fact that within the date range of the data, EViews is able to use the workfile
structure to identify an irregular calendar, but since there is no corresponding
information for the dates beyond the range of the workfile, EViews is forced to use the
regular frequency calendar.
A few examples will help to illustrate the basic concepts. Suppose for example, that
we have an irregular dated annual workfile with observations for the years “1991,”
“1994,” “1995,” “1997,” “2000,” and “2002”:
For the start of the date pair, we note that the observation for “1995” corresponds to
the start date. Computing the offset “-1” simply adds the “1994” observation.
For the end of the date pair, we note that “2004” is beyond the last observation in the
workfile, “2002”. We begin by computing offsets to “2004” using the regular frequency
calendar, until we reach the highest date in the workfile, so that we “drop” the two
observations “2004” and “2003”. The remaining two offsets, which use the observed
dates, drop the observations for “2002” and “2000”. The resulting sample includes the
observations “1994,” “1995,” and “1997”.
Sample Objects
As you have seen, it is possible to develop quite elaborate selection rules for the
workfile sample. However, it can become quite cumbersome and time-consuming to
re-enter these rules if you change samples frequently. Fortunately, EViews provides
you with a method of saving sample information in an object which can then be
referred to by name. If you work with many well-defined subsets of your data, you will
soon find sample objects to be indispensable.
Creating a Sample Object
To create a sample object, select Object/New Object… from the main menu or the
workfile toolbar. When the New Object dialog appears, select Sample and, optionally
provide a name. If you do not provide a name, EViews will automatically assign one
for you (sample objects may not be untitled). Click on OK and EViews will open the
sample object specification dialog:
Here is a partially filled-in sample object dialog for SMPL1. Notice that while this dialog
looks very similar to the one we described above for setting the sample, there are
minor cosmetic differences: the name of the sample object appears in the title bar,
and there is a check box for setting the workfile sample equal to this sample object.
These cosmetic differences reflect the two distinct purposes of the dialog: (1) to define
the sample object, and (2) to set the workfile sample. Since EViews separates the act
of defining the sample object from the act of setting the workfile sample, you can define
the object without changing the workfile sample, and vice versa.
To define the sample object, you should fill out this dialog as described before and
click on OK. The sample object now appears in the workfile directory with a double-
arrow icon.
To declare a sample object using a command, simply issue the sample declaration,
followed by the name to be given to the sample object, and then the sample string:
sample mysample 1955m1 1958m12 if rc>3.6
EViews will create the sample object MYSAMPLE which will use observations
between 1955:01 and 1958:12, where the value of the RC series is greater than 3.6.
Using a Sample Object
You may use a previously defined sample object directly to set the workfile sample.
Simply open a sample object by double clicking on the name or icon. This will reopen
the sample dialog. If you wish to change the sample object, you may edit the sample
specification; otherwise, simply click the Set workfile sample check box and click on
OK.
Or, you may set the workfile sample using the sample object, by entering the smpl
command, followed by the sample object name. For example, the command:
smpl mysample
will set the workfile sample according to the rules contained in the sample object
MYSAMPLE.
For many purposes, you may also use a named sample object as though it were an
ordinary EViews series containing the values 1 and 0, for observations that are and
are not included, respectively. Thus, if SMP2 is a named sample object, you may use
it as though it were a series in any EViews expressions (see “Series Expressions”).
For example:
y1*(smp2=0) + 3*y2*(smp2=1)
is a valid EViews expression, evaluating to the value of 3*Y2 if an observation is in
SMP2, and Y1, otherwise.
You may also, for example, create a new series that is equal to a sample object, and
then examine the values of the series to see which observations do and do not satisfy
the sample criterion.
Additionally, one important consequence of this treatment of sample objects is that
you may use sample objects in the construction of other sample objects. For example,
if you create a sample object FEMALE containing observations for individuals who are
females,
sample female @all if gender="female"
and a second sample object HIGHINC if INCOME is greater than 25000:
sample highinc @all if income>25000
You may set the sample to observations where individuals are low income females
using:
smpl @all if female and not highinc
where we use the NOT keyword to take the complement of the observations in
HIGHINC. To create a sample object HIGHFEMALE using this sample, use the
command:
sample highfemale @all if female and not highinc
Alternatively, we could have used the equivalent expression
sample highfemale @all if female and highinc=0
More generally, we may use any expression involving sample objects and the
keywords “AND”, “OR”, and “NOT”, as in
smpl 1950 1980 if female or not highinc
which sets the sample to those observations from 1950 to 1980 that are also in the
sample FEMALE, but not in the sample HIGHINC.
Importing Data
Earlier, we described workfile creation tools that allow you to open data from foreign
sources into a new workfile (“Creating a Workfile by Reading from a Foreign Data
Source”). This is most likely the easiest way to move data from foreign files and
database sources such as ODBC into EViews and we recommend it as your first
approach, but you should note that these tools are expressly designed for creating
new workfiles.
Alternatively, you may wish to import data into an existing workfile, perhaps into
existing series in the workfile—you may, for example, wish to read a portion of an
Excel file into a subset of observations in a series or group of series. We term the
reading of data into existing workfiles and/or series importing series data to distinguish
it from the creation of entirely new workfiles and series.
There are several methods for importing series data into EViews. In the remainder of
this discussion, we outline the basics of data import from spreadsheet, text file, or
printed formats, into series and group objects. Note that we omit, for the moment,
discussion of importing data into EViews matrix, vector and pool objects, and
discussion of EViews and foreign databases:
• Matrix and vector import tools are touched on briefly in “Matrix and Table Object
Import”.
Entering Data
For small datasets in printed form, you may wish to enter the data by typing at the
keyboard.
• Your first step is to open a temporary spreadsheet window in which you will enter
the data. Choose Quick/Empty Group (Edit Series) from the main menu to open an
untitled group window:
• The next step is to create and name the series. First click once on the up arrow in
the scroll bar to display the second obs label on the left-hand column. The row of cells
next to the second obs label is where you will enter and edit series names.
Click once in the cell next to the second obs label, and enter your first series name.
Here we have typed “income” in the edit window (the name in the cell changes as we
type in the edit window). Press RETURN. If you enter the name of an existing series,
the series data will be brought into the group.
• EViews will prompt you to specify a series type for the column. You may select a
numeric series, numeric series containing date values, or an alpha series. When you
click on OK, EViews will create a numeric or alpha series and will apply formatting
information that will aid you in viewing your data.
• You should repeat this procedure in subsequent columns for each additional series.
If you decide you want to rename one of your series, simply select the cell containing
the series name, edit the name in the edit window, and then press RETURN. EViews
will prompt you to confirm the series rename.
• To enter the data, click on the appropriate cell and type the number or text. Pressing
RETURN after entering the cell value will move you to the next cell. If you prefer, you
can use the cursor keys to navigate the spreadsheet.
• When you are finished entering data, close the group window. If you wish, you can
first name the untitled group by clicking on the Name button. Otherwise, if you do not
wish to keep the group, answer Yes when EViews asks you to confirm the deletion.
Copying-and-Pasting
The Windows clipboard is a handy way to move small amounts of data within EViews
and between EViews and other software applications. It is a natural tool for importing
these types of data from Excel and other Windows applications that support Windows
copy-and-paste.
Copying from Windows Applications
The following discussion involves an example using an Excel spreadsheet, but the
basic principles apply for other Windows applications.
Suppose you have bond yield and interest rate data in an Excel spreadsheet that you
would like to bring into EViews.
Open the spreadsheet in Excel. Your first step is to highlight the cells to be imported
into EViews. Since the column headings YIELD and INTEREST will be used as
EViews variable names, you should highlight them as well. Since EViews understands
dated data, and we are going to create a monthly workfile, you do not need to copy
the date column. Instead, click on the column label B and drag to the column label C.
The two columns of the spreadsheet will be highlighted.
• Make certain that the group window is showing the sample range that corresponds
to the data on the clipboard.
• Next, make certain that the group window is in edit mode. If not in edit mode, press
the Edit +/– button to toggle to edit mode. Place the cursor in the target cell, and select
Edit/Paste from the main menu.
Importing Data
EViews provides easy-to-use tools for importing data into an existing workfile,
matching observations between the source and destination as required. The source
data may be available in any of a number of data formats, from one of the EViews
supported foreign file formats (i.e., Microsoft Excel, ASCII text, SPSS, SAS portable,
Stata, etc.), to an EViews format workfile.
Opening the Source File
To use the import tools, first, make certain that you have an open workfile to receive
the contents of the data import and that the workfile window is active, then click on
File-Import/Import from File... or click on the Proc menu of the workfile and select
Import from File... In either case, EViews will display a standard file Open dialog.
Next, type the name of the file you wish to read (with full path information, if
appropriate) or select a file type, navigate to the directory containing the file, and
double click on the name. Click on the Open button to continue.
(Alternately, you may simply drag-and-drop the source file onto the open workfile
window.)
EViews will open the file (automatically determining the file type, if possible, or
interpreting the file as ASCII text, if not). Next, EViews may display a set of dialogs
prompting you for information about the structure of the data you are reading. These
dialogs are identical to those encountered when you open a file as a new workfile (see
“Creating a Workfile by Reading from a Foreign Data Source”). Fill out the dialogs
appropriately, clicking on Next at each step.
Once you have described the file and data, EViews will display a dialog prompting you
for details on how you wish to perform the import of data:
There are two parts to the import specification: the choice of import method and the
setting of various import options.
In the top-left portion of the dialog is the Import method dropdown, which controls how
the source data will be read into the existing workfile. The area to the right of the
dropdown will change to show options associated with the currently selected method.
Directly below the Import method dropdown is the Import options section, which offers
access to settings for renaming series and specifying frequency conversion methods.
Additionally, depending on the precise form of your import, you may be presented with
additional dialogs for resizing the destination workfile or choosing how to handle import
name conflict.
The bottom portion of the dialog consists of an import preview display, which shows a
sample of destination observations along with corresponding data from the source file.
The preview will change along with your selected import method specification.
We discuss all of these settings and choices below.
Import Method
The central question in importing data is how to relate observations in the source file
to observations in the destination workfile. The Import method dropdown at the top left
of the dialog should be used to specify the desired method. Depending upon the
structure of the destination workfile, you will be asked to select between four or five
import methods: Dated read (only if destination workfile is dated), Matched Read,
Sequential Read, Append to end, and Create new page.
Each method has a variety of associated settings, so we consider each in turn.
Dated Read
You may perform a dated read if the destination workfile is a dated (or panel dated)
workfile. In a dated read, observations in the source file are matched by date to
observations in the current workfile page, with frequency conversion performed if
necessary. The concepts underlying dated reads are identical to those in creating links
between two dated workfile pages, as outlined in “Linking by date with frequency
conversion”.
To perform a dated read you must first specify the date structure of the source workfile.
Accordingly, when you select Dated read in the Import method dropdown, the upper
portion of the dialog will change to show you date settings for the data to be imported.
When the source file is first opened for dated read, EViews will attempt to identify a
date series in the file (i.e. a column of data containing dates), and to determine the
date frequency of those dates. If a source date series is located, the Basic structure
dropdown will be set to Dated - specified by date series and the source name will be
entered in the Date series edit field. If no date series is identified, the import file data
structure will be set to match the destination.
Altering the specified date structure changes the nature of the import since it affects
the matching of observations between the source and destination. To aid you in
visualizing the effect of this setting, the left-hand column of the data preview display
updates with changes in the structure to show you the current date matching settings:
Here, we see that the source observation with OBS value 1959Q1 is matched with the
workfile destination observation 1959M1 and that the source observation with
OBS=1959Q2 is matched with the destination observation 1959M4. Note that there
are no matches for the source observation OBS=1958Q4 since the destination
workfile begins in 1959.
If we were instead importing into an annual file, the bottom portion of the display would
change to
depicting the matching of quarterly observations in the source file with annual
observations in the destination workfile.
In both of these examples, importing of the data into the page requires frequency
conversion. To control the frequency conversion method, you may click on the
Frequency Conversion button on the left-hand side of the page to bring up the
conversion settings.
As usual, you may control both the high-to-low and the low-to-high frequency
conversion method. By default, EViews will use the method specified in the destination
series (or the global defaults, if the destination series does not yet exist). When
converting from high-to-low using a specific method such as Average observations,
you will be given the option of selecting the No conversion of partial periods checkbox
so that no conversion is allowed if there are missing data for a given low frequency
period.
Click on OK to close the dialog and accept the conversion method.
In most cases, EViews will have correctly identified the date series so that the default
settings will require no change. Click on the Finish button complete the import
specification and instruct EViews to begin the import procedure.
EViews will now ask if the new series objects should be linked back to the source.
Click Yes to mark the new series objects as externally linked. Linked objects can be
refreshed with updated data when the workfile is next opened, or on demand by right-
clicking on the workfile window and selecting Update from DB… or by clicking on
Objects/Manage Links & Formulae... in the main menu to display the link management
dialog.
You may, if desired, override the default EViews date specification settings by
changing the Basic structure dropdown menu setting to either Dated - regular
frequency or Dated panel, and then using the dialog to specify the data frequency
explicitly.
For example, if you select Dated - regular frequency in the Basic structure dropdown,
the dialog changes to reflect the new settings:
Notice that EViews no longer shows the date series under Basic structure, instead
prompting you to provide a Frequency/date specification using the Frequency
dropdown menu and the Start date edit field. EViews will assume that the source file
has sequential observations of the given frequency beginning in the specified date.
Since we have not yet specified a Start date, the “?”s in the observation preview at the
bottom of the dialog indicate that the observation matching is indeterminate. Once a
start date is specified, the display will be updated to depict matching observations.
If the destination workfile is panel structured, you may instead choose Dated Panel in
the Basic structure dropdown.
When Dated Panel is selected, the import structure section of the dialog changes,
prompting you to specify a Cross section ID series and a Date series. If you continue
with the import, EViews will perform the date and ID matching as specified.
Matched Read
The Matched Read method performs a general match-merge between the data in the
source file and the current workfile page. The concept is outlined in detail in “Linking
by general match merging”.
To perform a matched read import, change the Import method dropdown to Matched
read, then specify the Source Index Series and corresponding Destination Index
Series that will be used as define observation matches. In many cases, EViews will
suggest likely values for the match indices determined by examining the contents of
the source file and destination workfile.
Suppose for example, that your destination workfile has data on unemployment rates
in each of the EU countries, you might have an identifying series called “COUNTRY”
containing the country names. If you have a corresponding series in the source file,
called “NATION,” that also contains country names, then you would specify “NATION”
as the source index, and “COUNTRY” as the destination index. Note that the
observations in the source index need not be in the same order as they are in the
destination.
In the simplest case, your index series will contain identical observation identifiers that
can be used to match up the observations in the two files. If the matches are one-to-
one or if there are multiple destination matches for every source observation (one-to-
many), EViews will simply perform the merge in the obvious fashion, repeating source
observations for every destination observation if necessary.
If, however, the matching is many-to-one so that there are multiple source
observations for a given destination observation, EViews will contract the source data
before performing the match merge. You may control the contraction method using
the Contraction Method dropdown.
Suppose, for example, that your destination workfile contains a series COUNTRY
containing the identifiers for “Mexico,” “Canada,” and “US”, your source file contains
U.S. state level data. You should enter COUNTRY as your Destination Index Series
and indicate that your source should be matched with the “US” destination
observation. (In the likely event that the source file does not have a COUNTRY series,
you can create an auto-series by typing “US”, with the quotes, in the Source Index
Series box.) Note that in this case, the state level data must first be contracted
(summarized) before it is matched to the “US” observation in the destination. To
contract the source data by taking the sum of the states as a value for “US”, you would
set the Contraction Method to Sum.
The last dialog setting, Match NA values in index series, should be checked if you
want to treat the NA value as a distinct category for purposes of defining matches.
The observation preview in the bottom of the dialog may be used to assess the validity
of your source and destination index specifications.
Sequential Read
A sequential import uses no information on the structure of the source data, it simply
places each observation in the source file into the corresponding observation of the
destination workfile. Thus the first row of the source file will be placed in the first
observation of the destination, the second row will be placed in the second
observation, and so on.
For a sequential read, simply select Sequential read in the Import method dropdown.
There is only one setting; you may specify a destination sample in which to place the
data, so that the first observation of the source file will be placed into the first
observation of the specified sample, the second source observation will be placed in
the second sample observation, and so on.
As before, the observation preview in the bottom of the dialog may be used to preview
the destination for some of the source observations.
Append to End
The Append to end import method appends each row of the source file to the end of
the destination workfile. The existing workfile structure will be removed.
For example if your destination workfile is an annual file running from 1990 - 2000,
and the source file contains 5 rows of data, the import will place the 5 rows of data at
the end of the workfile, leaving you with an unstructured 16 observation workfile.
Create New Page
The Create new page method creates a new page in your workfile and reads the
source file into that new page. This form of data import is identical selecting Proc/Load
workfile page... in the workfile window or clicking on the New Page tab and selecting
Load workfile page... For additional detail, see “Creating a Page by Loading a Workfile
or Data Source”.
Importing Attributes
Support for reading in custom series attributes (along with the series data) specified
as header rows during an import from Excel and text files was introduced in EViews
10. For example, the following Excel spreadsheet has custom attributes for
Description, SKU, and State specified in header rows:
When we drag and drop this file onto EViews, the new Import Wizard dialog appears.
On the second page (Step 2), you may change how each header row is used:
By default, EViews will treat every header row as a Name field, but you can change
the row type for each header by selecting (or specifying a custom value for) the
attribute name:
You can now complete the import and verify that all custom attributes have been read
in correctly:
Both the wfopen and import commands have been modified to support new values for
the "namepos=" argument and a new "colheadnames=" argument to specify individual
attribute names for each column. See wfopen for more details.
Import Options
The Import options sections of the dialog consists of two buttons: Rename series and
Frequency conversion.
Pressing the Rename series button brings up a dialog that allows you to rename some
of the imported series to different names. Renaming the series on import allows you
to handle illegal input series names, and to avoid name conflicts with existing series.
The Frequency conversion button, which brings up a dialog that controls the high-to-
low and low-to-high frequency conversion methods, is enabled whenever you are
performing a dated import. See “Dated Read” for discussion.
Import Workfile Resizing
When you import data from a source file that contains observations for which there
are no destination workfile matches, EViews will prompt you to accommodate the data
by resizing the destination.
If, for example, your original workfile has observations from 1990M01 to 1994M12 and
you import quarterly data for 1990Q1 to 1996Q4, EViews will determine that there are
no destination observations corresponding to the source observations for 1995Q1 to
1996Q4. When you proceed with the import, EViews will display a dialog informing
you of this fact.
There are two ways to proceed. First, you may click on Yes to resize the destination
workfile, adding 24 monthly observations for 1995 to 1996. The merge will then
proceed using all of the data in the source.
Alternately, you may click on No to retain the original destination workfile range. In this
case, the 8 observations in the source file for 1995Q1 to 1996Q4 will be discarded on
import, and will not appear in the final destination workfile.
Import Name Conflict
If you select an import method that brings source data into the current workfile page,
and the source file contains series with the same name as an existing series, EViews
will display a dialog asking how you wish to handle the conflict.
You may choose to overwrite the existing series object (which will delete the existing
series and replace it with the source data), to merge the two series, to rename the
incoming series, or to cancel the import of the series. Clicking on the All button
performs the corresponding operation for all cases where there is conflict.
If you choose to Merge the source and destination series, EViews will use the Merge
Options dropdown settings to determine how to join the data:
• Always use source will overwrite the destination series values for all observations in
the source file, including observations where the source contains an NA.
• Prefer source will overwrite the destination series views with those from the source
file, excluding observations where the source contains an NA.
• Prefer destination will only overwrite an observation in the destination file if its
existing value is an NA.
Note that whatever the merge settings, observations in the destination workfile that
are not also in the source file will be unchanged.
Matrix and Table Object Import
The preceding discussion focused on importing data into series or group objects.
Similar tools are available for importing data directly into a matrix or table object from
external data.
Exporting Data
Automatic Export using Save As
The easiest way to save series data is to use the save your workfile page as a foreign
file. Simply select File/Save As from the main EViews menu, choose your destination
file type and provide a name, then fill out the dialogs as prompted.
EViews will prompt you to specify the variables and object you wish to save. You will
notice that the identifier series are listed first in the top portion of the dialog, with @date
selected and @enddate unselected by default. You may also specify the sample of
observations to be written, and for some output formats, the valmaps to be written.
(See “Creating a Workfile by Reading from a Foreign Data Source” for a discussion of
the dialog controls.)
Once you have specified the variables and sample of observations to export, click on
OK. EViews will write the specified data in the foreign data format.
Other Export Methods
For most applications, this method of saving data to a foreign format will be more than
sufficient. The remainder of this section discusses alternate methods that support
other object types. If, for example, you wish to export data held in a matrix object, you
will need to use one of the methods described below.
Copying and Pasting
You can click and drag in a spreadsheet view or table of statistical results to highlight
the cells you want to copy. Then click Edit/Copy… in the main menu to put the data
into the clipboard. You will see a dialog box asking whether to copy the numbers with
the precision showing on your screen (formatted copy) or to copy the numbers at full
precision (unformatted copy).
As a shortcut, you can highlight entire rows or columns of cells by clicking on the gray
border that surrounds the spreadsheet. Dragging across the border selects multiple
rows or columns. To copy several adjacent series from the spreadsheet, drag across
their names in the top border. All of their data will be highlighted. Then click
Edit/Copy… to put the data into the clipboard.
Once the data are on the clipboard, switch to the target application, highlight the cells
to which the data is to be copied and select Edit/Paste.
When pasting to a spreadsheet view or a table in EViews, if the paste cell range is
larger than the copy range, the data will be repeated to fill the entire paste range.
However, this will only occur if the paste range is proportional to copy range. Ranges
are considered proportional when the paste range is a multiple of the copy range. For
example, if a 3 by 1 area (3 rows by 1 column) is copied, the paste range must be at
least 3 by 1. Proportional paste ranges could include 3 by 2, 6 by 1, 6 by 2, etc.
Exporting to a Spreadsheet or Text File
First, click on Proc/Export/Write Text-Lotus-Excel… from the workfile toolbar or main
menu, then enter the name and type of the output file in the SaveAs dialog. As you fill
out the SaveAs dialog, keep in mind the following behavior:
• If you enter a file name with an extension, EViews will use the file extension to
identify the file type. Files with common spreadsheet extensions (“.XLS”, “.WK3”,
“.WK1”, and “.WKS”) will be saved to the appropriate spreadsheet type. All others will
be saved as ASCII files.
• If you do not enter an extension, EViews will use the file type selected in the
dropdown to determine the output type. Spreadsheet files will have the appropriate
extensions appended to the name. ASCII files will be saved using the name provided
in the dialog, without an extension. EViews will not append extensions to ASCII files
unless you explicitly include one in the file name.
• Note that this method of export does not allow you to write into an existing file. If you
wish to add to a file you must use the automatic export method outlined in “Automatic
Export using Save As”.
Once you have specified the output file, click OK to open the export dialog.
The ability to save series object attributes when the destination is an Excel
spreadsheet file or text file was introduced in EViews 10. Attributes will be saved as
extra header rows. See wfsave for more details on the attr option.
Tip: if you highlight the series you wish to export before beginning the export
procedure, the series names will be used to fill out the export dialog.
Reading EViews Data using Other Applications
The EViews OLEDB driver provides an easy way for OLEDB-aware clients or custom
programs to read data stored in EViews workfiles (WF1) and EViews databases
(EDB).
We also provide an EViews Microsoft Excel Add-in that allows users to fetch and link
to EViews data located in workfiles and databases. The Add-in offers an easy-to-use
interface to OLEDB for reading EViews data from within Excel.
The following discussion offers only a brief overview of the OLEDB driver and the
Excel Add-in. For additional details, see the Using the EViews OLEDB Driver and
Using EViews Excel Add-in whitepapers available on our website
www.eviews.com/download/download.html.
The Excel Add-in
The EViews Excel Add-in offers a simple interface for fetching and linking from within
Microsoft Excel (97 and later) to series and matrix objects stored in EViews workfiles
and databases.
The method of installing and activating the EViews Excel Add-in our depends on which
version of Excel is installed. Excel 97 thru 2003 requires the use of a single “EViews
Add In.xla” file which is installed automatically by the EViews installer. Newer versions
of Excel require the use of our new Excel 2007 Add-In, installation of which is offered
as a separate option during the EViews installation procedure.
Once installed, you may need to activate the Add-in from within Microsoft Excel. Open
the Excel Add-ins management dialog:
and use the Manage dropdown menu to select the EViews Excel Add-in. Excel 97-
2003 users will find our add-in under “Excel Add-ins” in the Excel Add-ins management
dialog:
while Excel 2007 and above users will find the newer add-in under “COM Add-ins”,
Enable the EViews Add-ins entry by clicking on the checkbox, then click on OK.
Once enabled, you may use the Add-in to retrieve EViews data. The following Excel
2007 instructions illustrate use of the EViews Add-in to retrieve data:
• From the Add-ins ribbon, select Get Data from the EViews section to display the Get
EViews Data popup dialog. A File Open dialog will appear, prompting you to select an
existing EViews workfile or database. If the specified source is a workfile, a Page
dropdown menu will display all available pages; simply pick the page from which you
wish to read. If the source is a database, a Freq dropdown menu will let you filter the
series in the database by frequency.
• You may use the Types dropdown menu to change the default series object filter so
that you only consider matrix objects.
• You may further filter objects by name and description by clicking on the Filter...
button and entering restrictions in the dialog:
• You may select one or more series objects or a single matrix object and click on
Import or Import & Link to continue. If you wish, you may instead click on Add to add
selected items to the Objects to import list. Clicking on Add All adds all of the displayed
items to the import list. You may also type in the name of the objects to import. Once
your list is complete, click on Import or Import & Link to proceed. The import list
approach is particularly useful if you wish to build-up a list of objects using various
approaches or multiple filtered lists.
• The last step is to import or link the EViews data into Excel. On the resulting Select
Insert Point popup, you should specify a destination cell in your Excel worksheet (you
can click on a target cell to fill out the dialog). Click on OK.
At this point, the data should now be displayed in the specified worksheet. If we select
Import & Link instead of Import in the first step, this data will automatically refresh itself
every time the worksheet is opened. (Note: this worksheet must be saved in a trusted
location to allow the data to refresh properly. See the Microsoft Excel documentation
regarding “Trusted File Locations” for details.)
The OLEDB Driver
The EViews OLEDB driver is automatically installed and registered on your computer
when you install EViews. Once installed, you may use OLEDB-aware clients or custom
programs to read series, vector, and matrix objects directly from EViews workfiles and
databases.
For additional details, see the Using the EViews OLEDB Driver whitepaper.
The following instructions for Excel 2007 illustrate the use of built-in OLEDB support
to read EViews workfile data. (Note that “The Excel Add-in” describes a streamlined
interface for performing the same operation.)
• From the Data ribbon, select From Other Sources in the Get External Data section.
In the dropdown, select From Data Connection Wizard. In the Data Connection
Wizard, select Other/Advanced in the listbox and click Next.
• In the Data Link Properties popup, select EViews OLE DB Provider and click Next.
• On the Connection tab, select an EViews workfile or database and click OK (not
shown).
• Next, on the Data Connection Wizard popup, you should see a dropdown with all
the available pages (if a workfile was selected) and in the grid below a list of readable
series, vector, and matrix objects. Select one here and click Finish.
• On the Import Data popup, point to where you'd like to see the data in the worksheet
and click OK.
• At this point, you should see the data (and any corresponding ID series data) appear
in the specified worksheet
Frequency Conversion
Every series in EViews has an associated frequency. When a series is in a workfile,
the series is stored at the frequency of the workfile. When a series is held in a database
(“EViews Databases”), it is stored at its own frequency. Since all series in the same
workfile page must share a common frequency, moving a series from one workfile to
another or from a database to a workfile page will cause the series being moved to be
converted to the frequency of the workfile page into which it is being placed.
Performing Frequency Conversion
Frequency conversion is performed in EViews simply by copying or fetching a series
with one frequency into a workfile of another frequency.
Copy-and-Paste
Suppose that you have two workfile pages (or a source database and a destination
workfile page), where the source contains quarterly data on the series YQ, and the
destination workfile contains annual data. Note that you may copy between pages in
the same workfile or between separate workfiles.
To convert YQ from a quarterly to annual frequency, you may copy-and-paste the
series from the source quarterly workfile to the annual workfile. Click on the YQ series
in the quarterly workfile, press the right-mouse button and select Copy, navigate to the
annual workfile, then right mouse button and select Paste or Paste Special....
If you select Paste, EViews will copy YQ to the annual page, using the default
frequency conversion settings present in YQ to perform the conversion.
If you select Paste Special..., EViews will display a dialog offering you the opportunity
to override the default frequency conversion settings. Before describing this dialog
(“Overriding Default Conversion Methods”), we provide a background on frequency
conversion methods, and describe how default conversion methods are specified in
EViews.
Drag-and-Drop
An alternative to copy-and-paste is to use drag-and-drop to copy files between workfile
pages. Simply select the series to be copied, then drag-and-drop them on the
destination page tab. If you use the right-mouse button to select the series, dropping
them on the new tab will bring up the Paste Special dialog.
You can even drag-and-drop a workfile page tab into a workfile window to copy all of
the objects from one workfile page into another. Depending on the objects being
copied and the frequencies of the workfiles, you may receive a series of prompts to
assist in completing the paste properly.
Using Commands
You may use either the copy or fetch command to move series between workfiles or
between a database and a workfile. EViews will perform frequency conversion if the
frequencies of the source and destination do not match.
See copy and fetch for details.
Frequency Conversion Methods
There are three types of frequency conversion: high frequency to low frequency
conversion, low frequency to high frequency conversion, and frequency conversion
between a dated and undated workfile.
EViews provides you with the ability to specify methods for all types of conversion. In
addition, there are settings that control the handling of missing values when
performing the conversion.
High Frequency to Low Frequency
If a numeric series being imported has a higher frequency than the workfile, you may
choose between a number of different conversion methods:
• Average observations
• Sum observations
• First observation
• Last observation
• Maximum observation
• Minimum observation
• No down conversions
with the latter setting permitting you to disallow high to low conversions. In this case,
EViews will generate an error if you attempt to convert from high to low frequency.
In addition, you may specify how EViews handles missing data when carrying out the
calculations. You may elect to propagate NAs so that whenever a missing value
appears in a calculation, the result for the corresponding period will be an NA.
Alternatively, you may elect not to propagate NAs so that calculations will be
performed ignoring the missing values (though if all values for a period are missing,
the corresponding result will still be an NA).
Low Frequency to High Frequency
EViews also provides a number of different interpolation methods for dealing with the
case where the series being brought into the workfile has a lower frequency than the
workfile. Since observing a series at a lower frequency provides fundamentally less
information than observing the same series at a higher frequency, it is generally not
possible to recover the high frequency series from the low frequency data.
Consequently, the results from EViews’ interpolation methods should be considered
to be suggestive rather than providing the true values of the underlying series.
EViews supports the following interpolation methods:
• Constant: Constant with sum or average matched to the source data.
• Quadratic: Local quadratic with sum or average matched to the source data.
• Linear: Linear with first or last observation matched to the source data.
• Cubic: Cubic spline with first or last observation matched to the source data.
• Point: Copy the low frequency data into the first or last observation for the
corresponding high frequency range.
• Denton: Statistical interpolation minimizing the proportional first difference between
the interpolated and high frequency target series.
• Chow-Lin: Regression-based interpolation relating one or more high frequency
target series to the low frequency series.
• Litterman: Random walk variant of Chow-Lin.
• No up conversions: Do not allow up conversion.
Using an interpolation method which matches the average means that the average of
the interpolated points for each period is equal to the source data point for that period.
Similarly if the sum is matched, the interpolated points will sum to the source data
point for the period, and if the last observation is matched, the last interpolated point
will equal the source data point for the period.
For all methods, all relevant data from the low frequency series is used when forming
the high frequency series, even if the destination observations are a subset of the
observations available in the source.
The following describes the different methods in greater detail.
Constant
The constant method assigns the same value to all observations in the high frequency
series associated with a particular low frequency period. If you match average, the
value is chosen so that the average of the high frequency observation matches the
low frequency observation (the value is simply repeated). If you match sum, the value
is chosen so that the sum of the high frequency observations matches the low
frequency observation (the value is divided by the number of observations).
Quadratic
Fits a local quadratic polynomial for each observation of the low frequency series, then
use this polynomial to fill in all observations of the high frequency series associated
with the period. The quadratic polynomial is formed by taking sets of three adjacent
points from the source series and fitting a quadratic so that either the average or the
sum of the high frequency points matches the low frequency data actually observed.
For most points, one point before and one point after the period currently being
interpolated are used to provide the three points. For end points, the two periods are
both taken from the one side where data are available.
This method is a purely local method. The resulting interpolation curves are not
constrained to be continuous at the boundaries between adjacent periods. Because
of this, the method is better suited to situations where relatively few data points are
being interpolated and the source data is fairly smooth.
Linear:
This method assigns each value in the low frequency series to the first or last high
frequency observation associated with the low frequency period, then places all
intermediate points on straight lines connecting these points.
Cubic
This method assigns each value in the low frequency series to the first or last high
frequency observation associated with the low frequency period, then places all
intermediate points on a natural cubic spline connecting all the points.
A natural cubic spline is defined by the following properties:
1. Each segment of the curve is represented by a cubic polynomial.
2. Adjacent segments of the curve have the same level, first derivative and second
derivative at the point where they meet.
3. The second derivative of the curve at the two global end points is equal to zero
(this is the “natural” spline condition).
Cubic spline interpolation is a global interpolation method so that changing any one
point (or adding an additional point) to the source series will affect all points in the
interpolated series.
Point
The point method simply copies the low frequency data into the first or last observation
for the corresponding high frequency range.
Denton
This method finds an interpolated series z by relating a higher-frequency indicator
series z to a lower-frequency benchmark series y. This is done by minimizing the
proportional first difference function proposed by Denton (1971):
𝑥(𝑡) 𝑥(𝑡−1)2
𝐹 = ∑𝑇𝑖=1 ( − ) (5.1)
𝑧(𝑡) 𝑧(𝑡−1)
with the benchmark y in each period k, and bk and ek are the beginning and end of
each period. For stock variables the constraints apply at specific points in time (bk=ek)
where the interpolated series is equal to the benchmark yk. For index and flow
variables the average or sum of the interpolated series over each period k are equal
to the benchmark yk for that period. For flow variables this process is sometimes called
temporal distribution/disaggregation instead of interpolation.
EViews uses Cholette's (1984) modification of Denton's original method to remove a
transient movement at the beginning of the interpolated series.
The goal of Denton interpolation is movement preservation: the interpolated series
should preserve the movement in the indicator series as much as possible. While
there are many ways to specify the constraint problem, EViews uses the more popular
proportional first difference in Equation (5.1) and Equation (5.2), which minimizes the
proportional period-to-period change in the interpolated and indicator series. This
produces an interpolated series that closely follows the growth rate of the indicator
series.
Denton interpolation is a global interpolation method. Changing any point or adding
points to the indicator or benchmark series will affect all points in the interpolated
series. Also note that Denton interpolation can be performed without an indicator
series in a procedure sometimes termed benchmarking (in practice, the indicator
series z in Equation (5.1) is replaced by ones). In cases where the indicator series
extends beyond the period covered by the endpoints of the benchmark series, z will
be extrapolated with the last benchmark/indicator ratio.
Chow-Lin
The Chow-Lin method is a regression-based interpolation technique that finds values
of a series by relating one or more higher-frequency indicator series to a lower-
frequency benchmark series through the equation
𝑥(𝑡) = 𝑍(𝑡)𝛽 + 𝛼(𝑡) (5.3)
where β is a vector of coefficients and a(t) is a random variable with mean zero and
covariance matrix V. The interpolated series is subject to the same constraints as in
Equation (5.2) for stock, index, and flow variables. While the original solution by Chow
and Lin (1971) used generalized least squares to estimate the covariance matrix
assuming that the errors follow an AR(1) process, EViews uses a state space model
with the following time series model for the states:
𝑎(𝑡) = 𝜌𝑎(𝑡 − 1) + 𝜖(𝑡) (5.4)
where (t)~N(0, 𝜎 2 ) and |𝜌| < 1. The parameters and β are estimated via
maximum likelihood and the Kalman filter, and the interpolated series is subsequently
calculated with Kalman smoothing.
Chow-Lin interpolation is a global interpolation method, and changing any point or
adding points to the indicator or benchmark series will affect all points in the
interpolated series. Also note that Chow-Lin interpolation can be done without an
indicator series (in practice, the indicator matrix Z in Equation (5.3) is replaced by a
vector of ones). In cases where the indicator series extends beyond the period
covered by the endpoints of the benchmark series, x will be extrapolated using the
Kalman filter.
Litterman
For the Chow-Lin method the calculation of the interpolated series requires knowledge
of the covariance matrix , which is usually not known. Various techniques use various
assumptions about the structure of beyond the simplest (and unrealistic) case of
homoskedastic, uncorrelated residuals. A common flavor of Chow-Lin is Litterman
interpolation, in which the covariance matrix is calculated from residuals that follow:
a(t) = a(t − 1) + ϵ(t)
where ∈ ~𝑁(0, 𝑉) and
ϵ(t) = ρϵ(t − 1) + e(t)
and the initial condition 𝑎(0) = 0. This is essentially an ARIMA(1,1,0) model.
Undated Conversion
If you fetch or copy a series to or from an undated or unstructured workfile into or from
a dated workfile, the data will be copied sequentially, beginning at the starting
observation number of the undated or unstructured series (generally the first
observation).
Panel Conversion
Performing frequency conversion when either the source or destination are panel
workfile pages raises a number of additional issues. See “Panel links with date
matching” and “Panel frequency conversion” for discussion of the general issues.
Specifying Default Conversion Methods
When performing frequency conversion of one or more series, EViews uses the
default settings in each series to perform the conversion. These settings may be
specified in each series using the Freq Convert tab of the Properties dialog. To access
the dialog, click on the Properties button on the series toolbar and select the Freq
Convert tab.
If the series default setting is set to EViews default, the series will take its frequency
conversion setting from the EViews global options (see “Frequency Conversion” in
Appendix A. “Global Options”). Here, the high to low conversion is set to Sum
observations, overriding the global setting, while the low to high uses the EViews
default global setting.
This two level default system allows you to set global default settings for frequency
conversion that apply to all newly created series, while allowing you to override the
default settings for specific series.
As an example of controlling frequency conversion using default settings, suppose
you have daily data consisting of HIGH, LOW, and CLOSE series for a particular stock,
from which you would like to construct a monthly workfile. If you use the default
frequency conversion methods, the monthly workfile will contain series which use the
series defaults, which is not likely to be what you want. By setting the frequency
conversion method of the HIGH series to Max observation, of the LOW series to Min
observation, and of the CLOSE series to Last observation, you may use conversion
to populate a monthly workfile with converted daily data that follow the desired
behavior.
Overriding Default Conversion Methods
If you use copy-and-paste to copy one or more series between two workfiles, EViews
will copy the series to the destination page, using the default frequency conversion
settings present in the series to perform the conversion.
If, when pasting the series into the destination, you use Paste Special... in place of
Paste, EViews will display a dialog offering you the opportunity to override the default
frequency conversion settings.
You need not concern yourself with most of the settings in this dialog at the moment;
the dialog is discussed in greater detail in “Frequency conversion links”.
We note, however, that the dialog offers us the opportunity to change both the name
of the pasted YQ series, and the frequency conversion method.
The “*” wildcard in the Pattern field is used to indicate that we will use the original
name (wildcards are most useful when pasting multiple series). We may edit the field
to provide a name or alternate wildcard pattern. For example, changing this setting to
“*A” would copy the YQ series as YQA in the destination workfile.
Additionally, we note that the dialog allows us to use the frequency conversion method
Specified in series or to select alternative methods.
If, instead of copy-and-paste, you are using either the copy or fetch command and you
provide an option to set the conversion method, then EViews will use this method for
all of the series listed in the command (see copy and fetch for details).
Popup
References
Denton, F. T. (1971). “Adjustment of monthly or quarterly series to annual totals: an
approach based on quadratic minimization,” Journal of the American Statistical
Association, 66(333), 99-102.
Chen, B. (2007). “An empirical comparison of methods for temporal distribution and
interpolation at the national accounts,” Bureau of Economic Analysis.
Cholette, P. (1984). “Adjusting sub-annual series to yearly benchmarks,” Survey
Methodology, 10, 35-49.
Chow, G. C., & Lin, A. L. (1971). “Best linear unbiased interpolation, distribution, and
extrapolation of time series by related series,” The Review of Economics and
Statistics, 53(4), 372-375.
Litterman, R. B. (1983). “A random walk, markov model for the distribution of time
series,” Journal of Business and Statistics, 1, 169-173.
VI. Working with Data
In the following discussion, we describe EViews’ powerful language for using numeric
expressions and generating and manipulating the data in series and groups. We first
describe the fundamental rules for working with mathematical expressions in EViews,
and then describe how to use these expressions in working with series and group
data.
More advanced tools for working with numeric data, and objects for working with
different kinds of data are described in “Working with Data (Advanced)”.
Numeric Expressions
One of the most powerful features of EViews is the ability to use and to process
mathematical expressions. EViews contains an extensive library of built-in operators
and functions that allow you to perform complicated mathematical operations on your
data with just a few keystrokes. In addition to supporting standard mathematical and
statistical operations, EViews provides a number of specialized functions for
automatically handling the leads, lags and differences that are commonly found in time
series data.
An EViews expression is a combination of numbers, series names, functions, and
mathematical and relational operators. In practical terms, you will use expressions to
describe all mathematical operations involving EViews objects.
As in other programs, you can use these expressions to calculate a new series from
existing series, to describe a sample of observations, or to describe an equation for
estimation or forecasting. However, EViews goes far beyond this simple use of
expressions by allowing you to use expressions virtually anywhere you would use a
series. We will have more on this important feature shortly, but first, we describe the
basics of using expressions.
Operators
EViews expressions may include operators for the usual arithmetic operations. The
operators for addition (+), subtraction (-), multiplication (*), division (/) and raising to a
power (^) are used in standard fashion so that:
5 + 6 * 7.0 / 3
7 + 3e-2 / 10.2345 + 6 * 10^2 + 3e3
3^2 - 9
are all valid expressions. Notice that explicit numerical values may be written in
integer, decimal, or scientific notation.
In the examples above, the first expression takes 5 and adds to it the product of 6 and
7.0 divided by 3 (5+14=19); the last expression takes 3 raised to the power 2 and
subtracts 9 (9 – 9 = 0). These expressions use the order of evaluation outlined below.
The “-” and “+” operators are also used as the unary minus (negation) and unary plus
operators. It follows that:
2-2
-2+2
2+++++++++++++-2
2---2
all yield a value of 0.
EViews follows the usual order in evaluating expressions from left to right, with
operator precedence order as follows (from highest precedence to lowest):
• unary minus (-), unary plus (+)
• exponentiation (^)
• and, or
• (-1 + -2) * (3 + 4), evaluates to –3 * 7 = –21. The unary minuses are evaluated first,
followed by the two additions, and then the multiplication.
• Functions for working with strings and dates are documented in “String Function
Summary” and “Date Function Summary” .
The remainder of this chapter will provide additional information on some of these
functions, then examples of expressions involving functions.
Series Elements
At times, you may wish to access a particular observation for a series. EViews
provides you with a special function, @elem, which allows you to use a specific value
of a series.
@elem takes two arguments: the first argument is the name of the series, and the
second is a quoted date or observation identifier.
For example, suppose that you want to use the 1980Q3 value of the quarterly series
Y, or observation 323 of the undated series X. Then the functions:
@elem(y, "1980Q3")
@elem(x, "323")
will return the values of the respective series in the respective periods.
Numeric Relational Operators
Relational comparisons may be used as part of a mathematical operation, as part of
a sample statement, or as part of an if-condition in programs.
A numeric relational comparison is an expression which contains the “=” (equal), “>=”
(greater than or equal), “<=” (less than or equal), “<>” (not equal), “>” (greater than),
or “<” (less than) comparison operators. These expressions generally evaluate to
TRUE or FALSE, returning a 1 or a 0, depending on the result of the comparison.
Comparisons involving strings are discussed in “String Relational Operators” .
Note that EViews also allows relational comparisons to take the value “missing” or NA,
but for the moment, we will gloss over this point until our discussion of missing values
(see “Missing Values”).
We have already seen examples of expressions using relational operators in our
discussion of samples and sample objects. For example, we saw the sample
condition:
incm > 5000
which allowed us to select observations meeting the specified condition. This is an
example of a relational expression—it is TRUE for each observation on INCM that
exceeds 5000; otherwise, it is FALSE.
As described above in the discussion of samples, you may use the “and” and “or”
conjunction operators to build more complicated expressions involving relational
comparisons:
(incm>5000 and educ>=13) or (incm>10000)
It is worth emphasizing the fact that EViews uses the number 1 to represent TRUE
and 0 to represent FALSE. This internal representation means that you can create
complicated expressions involving logical subexpressions. For example, you can use
relational operators to recode your data:
0*(inc<100) + (inc>=100 and inc<200) + 2*(inc>=200)
which yields 0 if INC<100, 1 if INC is greater than or equal to 100 and less than 200,
and 2 for INC greater than or equal to 200.
The equality comparison operator “=” requires a bit more discussion, since the equal
sign is used both in assigning values and in comparing values. We consider this issue
in greater depth when we discuss creating and modifying series (see “Series”). For
now, note that if used in an expression:
incm = 2000
evaluates to TRUE if INCOME is exactly 2000, and FALSE, otherwise.
Descriptive Statistics
Standard descriptive statistic functions are available in EViews. These include, but are
not limited to functions to calculate the mean (@mean), the median (@median), the
standard deviation (@stdev), the variance (@var) and covariance (@cov). The
descriptive statistic functions all take an optional sample as an argument. For a full list
of descriptive statistics functions, details on the use of samples, and some examples,
see “Descriptive Statistics” .
It should be noted that EViews offers two ways to calculate standard deviations,
variances and covariances. The simple standard deviation function, @stdev,
calculates the sample standard deviation, that is the square root of the sum-of-squares
divided by . To calculate the population standard deviation, that is division by n, use
the @stdevp function. Note for symmetry purposes there is also a @stdevs which
performs the same calculation as @stdev.
The @var and @cov functions calculate the population variance and covariance
respectively, i.e., they divide through by n. To calculate the sample variance or
covariance use the @vars or @covs functions. Again, there are also @varp and
@covp functions which do the same as @var or @cov.
Leads, Lags, Differences and Time Series Functions
It is easy to work with lags or leads of your series. Simply use the series name,
followed by the lag or lead enclosed in parentheses. Lags are specified as negative
numbers and leads as positive numbers so that,
income(-4)
is the fourth lag of the income series, while:
sales(2)
is the second lead of sales.
While EViews expects lead and lag arguments to be integers, there is nothing to stop
you from putting non-integer values in the parentheses. EViews will automatically
convert the number to an integer; you should be warned, however, that the conversion
behavior is not guaranteed to be systematic. If you must use non-integer values, you
are strongly encouraged to use the @round, @floor, or @ceil functions to control the
lag or lead behavior.
In many places in EViews, you can specify a range of lead or lag terms. For example,
when estimating equations, you can include expressions of the form:
income(-1 to -4)
to represent all of the INCOME lags from 1 to 4. Similarly, the expressions:
sales sales(-1) sales(-2) sales(-3) sales(-4)
sales(0 to -4)
sales(to -4)
are equivalent methods of specifying the level of SALES and all lags from 1 to 4.
The @lag function can also be used to specify lags. Thus the expressions:
@lag(sales,1)
sales(-1)
are equivalent. Note one useful function of @lag is that it will take the lag of everything
within parenthesis. @lag can therefore be used to find the lag of an expression.
Typing:
@lag((sales-income)/sales,4)
(sales(-4)-income(-4))/sales(-4)
yields identical results.
EViews also has several built-in functions for working with difference data in either
levels or in logs. The “D” and “DLOG” functions will automatically evaluate the
differences for you. For example, instead of taking differences explicitly,
income - income(-1)
log(income) - log(income(-1))
you may use the equivalent expressions,
d(income)
dlog(income)
You can take higher order differences by specifying the difference order. For example,
the expressions:
d(income,4)
dlog(income,4)
represent the fourth-order differences of INCOME and log(INCOME).
If you wish to take seasonal differences, you should specify both the ordinary, and a
seasonal difference term:
d(income,1,4)
dlog(income,1,4)
These commands produce first order differences with a seasonal difference at lag 4.
If you want only the seasonal difference, specify the ordinary difference term to be 0:
d(income,0,4)
dlog(income,0,4)
Other time series functions provided by EViews include a number of percentage
change type functions. The simplest of these, @pc calculates a simple one-period
percentage change in a series. For example typing:
@pca(income)
calculates the annual percentage change in INCOME.
Two special types of time series functions, moving functions and cumulative functions
are also available in EViews, and are described below.
Mathematical details of lags, leads, differences and percentage change functions are
provided in “Operator and Function Reference” .
Cumulative and Moving Statistic Functions
Cumulative and moving statistic functions provide information over a range, or
“window” of observations. The cumulative functions come in two types, those that
move forwards and those that move backwards. The forwards functions, which take
the form @cum[stat], have a window that starts at the start of the workfile (or if a
sample is given in the function, from the start of the sample) up until the current
observation.
The backwards functions, which take the form @cumb[stat], start at the end of the
workfile, or sample, and move backwards until the current observation.
Note for both type of cumulative function the length of the window is different for each
observation. The cumulative functions may be thought of as perform “running total”
type calculations. Missing values are not propagated in the cumulative functions, i.e.,
observations with a value equal to NA are simply skipped.
The moving statistic functions have a shorter, user specified, window length. They
provide information on the n observations up to, and including, the current observation,
where n is chosen by the user.
The moving functions come in two types, those that propagate missing values and
those that do not. For the functions that do propagate missing values, which take the
form @mov[stat], if any of the observations within the window contain an NA the
function will return NA. The functions that do not propagate, which take the form
@m[stat], will simply skip any NA observations.
For more information on missing values see “Missing Values”.
As an example, you could find out the maximum value of INCOME from the start of
the workfile to each observation by typing:
show @cummax(income)
If the first, say, four observations of INCOME are 100, 120, 110, 140 then this
command will show a series as 100, 120, 120, and 140 as the first four observations.
If you wanted to know at each observation the average of the previous 3 years
(including the current year) SALES figures you could type:
show @movav(sales,3)
Note this is equal to:
show (sales + sales(-1) + sales(-2))/3
Note that the lag or lead operators can be used inside a moving statistic function to
allow you to control the exact start and end point of your window. For example, if you
wanted to know, at each observation, the sum of SALES from three years ago, two
years ago and last year (i.e. the sum of SALES(-1), SALES(-2) and SALES(-3)) you
could type:
show @movsum(sales(-1),3)
Further details and a complete list of cumulative functions can be found in “Cumulative
Statistic Functions”, and for moving functions in “Moving Statistic Functions” .
Ranking Series
EViews has an @ranks function which will generate a series based upon the ranking
of another series. Ranking can be either ascending or descending depending upon
whether “a” or “d” is used as an option in the function. For example to create series,
ARANK, which contains the ascending ranks of the observations in the series SALES
you could type:
series arank = @ranks(sales,a)
and to create a series containing the descending ranks you could type:
series drank = @ranks(sales,d)
EViews provides a number of different ways of handling ties in the ranking. For more
details see @ranks in “Descriptive Statistics”.
Missing Values
Occasionally, you will encounter data that are not available for some periods or
observations, or you may attempt to perform mathematical operations where the
results are undefined (e.g., division by zero, log of a negative number). EViews uses
the code NA (not available) to represent these missing values.
For the most part, you need not worry about NAs. EViews will generate NAs for you
when appropriate, and will automatically exclude observations with NAs from
statistical calculations. For example, if you are estimating an equation, EViews will use
the set of observations in the sample that have no missing values for the dependent
and all of the independent variables.
There are, however, a few cases where you will need to work with NAs, so you should
be aware of some of the underlying issues in the handling of NAs.
First, when you perform operations using multiple series, there may be alternative
approaches for handling NAs. EViews will usually provide you with the option of
casewise exclusion (common sample) or listwise exclusion (individual sample). With
casewise exclusion, only those observations for which all of the series have non-
missing data are used. This rule is always used, for example, in equation estimation.
For listwise exclusion, EViews will use the maximum number of observations possible
for each series, excluding observations separately for each series in the list of series.
For example, when computing descriptive statistics for a group of series, you have the
option to use a different sample for each series.
If you must work directly with NAs, just keep in mind that EViews NAs observe all of
the rules of IEEE NaNs. This means that performing mathematical operations on NAs
will generate missing values. Thus, each of the following expressions will generate
missing values:
@log(-abs(x))
1/(x-x)
(-abs(x))^(1/3)
3*x + NA
exp(x*NA)
For the most part, comparisons involving NA values propagate NA values. For
example, the commands:
series y = 3
series x = NA
series equal = (y = x)
series greater = (y > x)
will create series EQUAL and GREATER that contain NA values, since the
comparison between observations in a series involving an NA yields an NA.
Note that this NA handling behavior differs from EViews 4 and earlier in which NAs
were treated as ordinary values for purposes of equality (“=”) and inequality (“<>”)
testing. In these versions of EViews, the comparison operators “=” and “<>” always
returned a 0 or a 1. The change in behavior was deemed necessary to support the
use of string missing values. In all versions of EViews, comparisons involving ordering
(“>”, “<”, “<=”, “>=”) propagate NAs.
It is still possible to perform comparisons using the previous methods. One approach
is to use the special functions @eqna and @neqna for performing equality and strict
inequality comparisons without propagating NAs. For example, you may use the
commands:
series equal1 = @eqna(x, y)
series nequal = @neqna(x, y)
so that NAs in either X or Y are treated as ordinary values for purposes of comparison.
Using these two functions, EQUAL1 will be filled with the value 0, and NEQUAL will
be filled with the value 1. Note that the @eqna and @neqna functions do not compare
their arguments to NA, but rather facilitate the comparison of values so that the results
are guaranteed to be 0 or 1. See also “Version 4 Compatibility Mode” for settings that
enable the previous behavior for element comparisons in programs.
To test whether individual observations in a series are NAs, you may use the @isna
function. For example,
series isnaval = @isna(x)
will fill the series ISNAVAL with the value 1, since each observation in X is an NA.
There is one special case where direct comparison involving NAs does not propagate
NAs. If you test equality or strict inequality against the literal NA value:
series equal2 = (x = NA)
series nequal2 = (y <> NA)
EViews will perform a special test against the NA value without propagating NA
values. Note that these commands are equivalent to the comparisons involving the
special functions:
series equal3 = @eqna(x, NA)
series nequal3 = @neqna(y, NA)
If used in a mathematical operation, a relational expression resulting in an NA is
treated as an ordinary missing value. For example, for observations where the series
X contains NAs, the mathematical expression
5*(x>3)
will yield NAs. However, if the relational expression is used as part of a sample or IF-
statement, NA values are treated as FALSE.
smpl 1 1000 if x>y
smpl 1 1000 if x>y and not @isna(x) and not @isna(y)
are equivalent since the condition x>3 implicitly tests for NA values. One consequence
of this behavior is that:
smpl 1 1000 if x<NA
will result in a sample with no observations since less-than tests involving NAs yield
NAs.
Very early versions of EViews followed the IEEE rules for missing data with one
important exception. In EViews 2 and earlier, multiplying any number by zero
(including NAs) yielded a zero. In subsequent versions, the value NA times zero
equals NA. Thus, an earlier recommended method of recoding (replacing) NA values
in the series X no longer worked so that the command for replacing NA values with
the values in Y:
x = (x<>na)*x + (x=na)*y
works in EViews 2, but does not work subsequent versions. The @nan function has
been provided for this purpose.
x = @nan(x,y)
recodes NA values of X to take the values in the series Y. See “Operators”.
Series
One of the primary uses of expressions is to generate new series from existing data
or to modify the values in an existing series. Used in combination with samples,
expressions allow you to perform sophisticated transformations of your data, saving
the results in new or existing series objects.
The current discussion focuses on the basic numeric series object. Users who wish to
work with alphanumeric or advanced series features should see “Working with Data
(Advanced)” and “Series Links”.
To create or modify a series, select Quick/Generate Series… or click on the Genr
button on the workfile toolbar. EViews opens a window prompting you for additional
information.
You should enter the assignment statement in the upper edit box, and the relevant
sample period in the lower edit box.
The assignment statement is actually an implicit loop over observations. Beginning
with the first observation in the sample, EViews will evaluate the assignment statement
for each included observation.
Basic Assignment
You can type the series name, followed by an equal sign and then an expression. For
every element of the sample, EViews will evaluate the expression on the right-hand
side of the equality, and assign the value to the destination series on the left-hand
side, creating the series if necessary.
For example, if there is no series named Y,
y = 2*x + 37*z
will first create the Y series and fill it with NAs. Then, for every observation in the
current sample, EViews will fill each element of the Y series with the value of the
expression. If Y does exist, EViews will only replace Y values in the current sample
with the value of the expression. All observations not in the sample will be unchanged.
One special form of assignment occurs when the right-hand side of the assignment
statement is a constant expression:
y=3
y = 37 * 2 + 3
EViews will simply assign the value of the constant to all of the observations in the
sample.
Using Samples
By modifying the sample of observations used in assignment, you can splice together
series using multiple series assignment commands. For example, if we enter three
assignment commands with different samples: first
Upper window: y = z
Lower window: @all if z<=1 and z>-1
followed by an assignment with,
Upper window: y = -2 + 3*z
Lower window: if z>1
and finally,
Upper window: y = -.9 + .1*z
Lower window: if z<=-1
we can generate Y as a piecewise linear function of the series Z. Note that the “@ALL”
is implicit in the latter two assignments.
While it is possible to perform these types of operations using loops and IF-
statements“EViews Programming”, we strongly urge you to use genr and sample
statements where possible, since the latter approach is much more efficient.
Dynamic Assignment
Since EViews evaluates the assignment expression for each observation in the
sample, you can perform dynamic assignment by using lagged values of the
destination series on the right side of the equality. For example, suppose we have an
annual workfile that ranges from 1945 to 1997. Then if we enter:
Upper window: y = y + y(-1)
Lower window: 1946 1997
EViews will replace the Y series with the cumulative sum of Y. We begin with 1946,
since we do not want to transform the first value in the workfile. Then for each period,
EViews will take the current value of Y and add it to the lagged value of Y. The
assignment is dynamic because as we successively move on to the next period, the
lagged value of Y contains the cumulative sum.
Note that this procedure destroys the original data. To create a new series with the
cumulative sums, you will have to perform the assignment in two steps, first making a
copy of the original series, and then performing the dynamic assignment.
Implicit Assignment
You can make an implicit assignment by putting a simple formula on the left-hand side
of the equal sign. EViews will examine your expression and select, as the destination
series, the first valid series name on the left-hand side of the equality. Then for every
observation in the sample, EViews will assign values using the implicit relationship.
For example, if you enter:
log(y) = x
EViews will treat Y as the destination series, and evaluate y=exp(x) for every
observation in the sample.
The following are examples of valid assignment statements where Y is the destination
series:
1/y = z
log(y/x)/14.14 = z
log(@inv(y)*x) = z
2+y+3*z = 4*w
d(y) = nrnd
In general, EViews can solve for, or normalize, equations that use the following on the
left-hand side of the equality: +, –, *, /, ^, log(), exp(), sqr(), d(), dlog(), @inv().
Since Genr is not a general equation solver, there will be situations in which EViews
cannot normalize your equation. You cannot, for example, use the assignment
statement:
@tdist(y, 3) = x
since @tdist is not one of the functions that EViews knows how to invert. Similarly,
EViews cannot solve for equations where the destination series appears more than
once on the left side of the equality. For example, EViews cannot solve the equation:
x + 1/x = 5
In both cases, EViews will display the error message “Unable to normalize equation”.
Note that the destination series can appear on both sides of the equality. For example:
log(x) = x
is a legal assignment statement. EViews will normalize the expression and perform
the assignment
x = exp(x)
so that X will be assigned the exponential of the original value of X. EViews will not
solve for the values of X satisfying the equality “LOG(X) = X”.
Using the Command Window
You can create series and assign values from the command window. First, set the
workfile sample using the smpl statement, then enter the assignment statement.
There are alternative forms for the assignment statement. First, if the series does not
exist, you must use either the series or the genr keyword, followed by the assignment
expression. The two statements:
series y = exp(x)
genr y = exp(x)
are equivalent methods of generating the series Y. Once the series has been created,
subsequent assignment statements do not require the series or the genr keyword:
smpl @all
series y = exp(x)
smpl 1950 1990 if y>300
y = y/2
This set of commands first sets the series to equal EXP(X) for all observations, then
assigns the values Y/2 for the subset of observations from 1950 to 1990 if Y>300.
Auto-series
Another important method of working with expressions is to use an expression in place
of a series. EViews’ powerful tools for expression handling allow you to substitute
expressions virtually any place you would use a series—as a series object, as a group
element, in equation specifications and estimation, and in models.
We term expressions that are used in place of series as auto-series, since the
transformations in the expressions are automatically calculated without an explicit
assignment statement.
Auto-series are most useful when you wish to see the behavior of an expression
involving one ore more series, but do not want to keep the transformed series, or in
cases where the underlying series data change frequently. Since the auto-series
expressions are automatically recalculated whenever the underlying data change,
they are never out-of-date.
See “Auto-Updating Series” for a more advanced method of handling series and
expressions.
Creating Auto-series
It is easy to create and use an auto-series—anywhere you might use a series name,
simply enter an EViews expression. For example, suppose that you wish to plot the
log of CP against time for the period 1953M01 to 1958M12. There are two ways in
which you might plot these values.
One way to plot these values is to generate an ordinary series, as described earlier in
“Basic Assignment”, and then to plot its values. To generate an ordinary series
containing the log of CP, say with the name LOGCP, select Quick/Generate series...
from the main menu, and enter,
logcp = log(cp)
or type the command,
series logcp = log(cp)
in the command window. EViews will evaluate the expression LOG(CP) for the current
values of CP, and will place these values into the series LOGCP. To view a line graph
view of the series, open the series LOGCP and select View/Graph/Line.
Note that the values of the ordinary series LOGCP will not change when CP is altered.
If you wish to update the values in LOGCP to reflect subsequent changes in CP, you
will need to issue another series or genr assignment statement.
Alternatively, you may create and use an auto-series by clicking on the Show button
on the toolbar, or selecting Quick/Show… and entering the command,
log(cp)
or by typing
show log(cp)
in the command window. EViews will open a series window in spreadsheet view:
Note that in place of an actual series name, EViews substitutes the expression used
to create the auto-series.
An auto-series may be treated as a standard series window so all of the series views
and procedures are immediately available. To display a time series graph of the
LOG(CP) auto-series, simply select View/Graph... from the series window toolbar and
click OK to create a line graph:
All of the standard series views and procedures are also accessible from the menus.
Note that if the data in the CP series are altered, the auto-series will reflect these
changes. Suppose, for example, that we take the first four years of the CP series, and
multiply theme by a factor of 10:
smpl 1953m01 1956m12
cp = cp*10
smpl 1953m01 1958m12
The auto-series graph will automatically change to reflect the new data:
In contrast, the values of the ordinary series LOGCP are not affected by the changes
in the CP data.
Similarly, you may use an auto-series to compute a 12-period, backward-looking,
geometric moving average of the updated CP data. The command:
show @exp(@movav(@log(cp),12))
will display the auto-series containing the geometric moving average. To view a line
graph of the auto-series, select View/Graph... from the series window toolbar and click
OK:
“Groups” below describes other useful techniques for working with auto-series.
Using Auto-Series in Estimation
One method of using auto-series in estimation is to allow expressions as right-hand
side variables. Thus, you could estimate an equation with log(x) or exp(x+z) as an
explanatory variable.
EViews goes a step beyond this use of auto-series, by allowing you to use auto-series
as the dependent variable in estimation. Thus, if you want to regress the log of Y on
explanatory variables, you don’t have to create a new variable LOGY. Instead, you
can use the expression log(y)as your dependent variable.
When you forecast using an equation with an auto-series dependent variable, EViews
will, if possible, forecast the untransformed dependent variable and adjust the
estimated confidence interval accordingly. For example, if the dependent variable is
specified as log(y), EViews will allow you to forecast the level of Y, and will compute
the asymmetric confidence interval. See “Forecasting from an Equation” for additional
details.
Groups
EViews provides specialized tools for working with groups of series that are held in
the form of a group object. In “Importing Data”, we used groups to import data from
spreadsheets into existing workfiles. Briefly, a group is a collection of one or more
series identifiers or expressions. Note that a group does not contain the data in the
individual series, only references to the data in the series.
To create a group, select Object/New Object.../Group and fill in the dialog with names
of series and auto-series. Or you may select Show from the workfile toolbar and fill out
the dialog. Alternatively, type the command group in the command window, followed
by a name to be given to the group and then the series and auto-series names:
group macrolist gdp invest cons
creates the group MACROLIST containing the series GDP, INVEST and CONS.
Similarly,
group altlist log(gdp) d(invest) cons/price
creates the group ALTLIST containing the log of the series GDP, the first difference of
the series INVEST, and the CONS series divided by the PRICE series.
There are a few features of groups that are worth keeping in mind:
• A group is simply a list of series identifiers. It is not a copy of the data in the series.
Thus, if you change the data for one of the series in the group, you will see the changes
reflected in the group.
• If you delete a series from the workfile, the series identifier will be maintained in all
groups. If you view the group spreadsheet, you will see a phantom series containing
NA values. If you subsequently create or import the series, the series values will be
restored in all groups.
• Renaming a series changes the reference in every group containing the series, so
that the newly named series will still be a member of each group.
• There are many routines in EViews where you can use a group name in place of a
list of series. If you wish, for example, to use X1, X2, and X3 as right-hand side
variables in a regression, you can instead create a group containing the series, and
use the group in the regression.
We describe groups in greater detail in “Groups”.
Accessing Individual Series in a Group
Groups, like other EViews objects, contain their own views and procedures. For now,
note that you can access the individual elements of a named group as individual
series.
To refer the -th series in the group, simply append “()” to the group name. For example,
consider the MACROLIST group, defined above. The expression MACROLIST(1) may
be used to refer to GDP and MACROLIST(2) to refer to INVEST.
You can work with MACROLIST(1) as though it were any other series in EViews. You
can display the series by clicking on the Show button on the toolbar and entering
MACROLIST(1). You can include GDP in another group directly or indirectly. A group
which contains:
macrolist(1) macrolist(2)
will be identical to a group containing
gdp invest
We can also use the individual group members as part of expressions in generating
new series:
series realgdp = macrolist(1)/price
series y = 2*log(macrolist(3))
or in modifying the original series:
series macrolist(2) = macrolist(2)/price
Note that in this latter example the series keyword is required, despite the fact that the
INVEST series already exists. This is true whenever you access a series as a member
of a group.
Other tools allow you to retrieve the number of series in a group using the @count
group data member:
scalar numgroup = macrolist.@count
To retrieve the names of each of the series, you may use the group data member
@seriesname. These tools are described in greater detail in “Group”.
Group Row Functions
EViews allows you to generate a series based upon the rows, or observations, in a
group. The most simple of these is the @columns function which simply returns a
series where every observation is equal to the number of series in a group. This
function provides exactly the same information as the @count data member of a
group. Thus the expression:
series numgroup = @columns(macrolist)
produces the same result as:
series numgroup = macrolist.@count
There are also functions that will calculate the mean of a group’s rows (@rmean), their
standard deviation (@rstdev) and variance (@rvar).
The @rvalcount function can be used to find how many times a specific value occurs
within the rows of a group. For example:
series numvals = @valcount(macrolist,5)
will create a series where each row of that series will be the count of how many of the
series within the MACROLIST group contain the value “5” for that particular row. Note
that the value argument for this function can be a scalar or a series.
A full list of the group row functions can be found in “Group Row Functions”.
Creating a Group By Expanding a Series
The @expand function allows you to create a group of dummy variables by expanding
out one or more series into individual categories. For example, if the series UNION
contains values equal to either “union”, “non-union”, then using:
group g1 @expand(union)
will create a group, G1, with two series, the first series containing 1 where-ever union
is equal to “union” and zero elsewhere, the second series containing 1 where-ever
union is equal to “non-union” and zero elsewhere.
@expand may also be used on more than one series to give the cross-interaction of
different series. Thus if you have a second series called MARRIED that contains either
“married” or “single” then entering:
group g2 @expand(union,married)
will create a group, G2, with four series, the first containing 1 where-ever UNION is
equal to “union” and MARRIED is equal to “married”, the second series containing a
1 where-ever UNION is equal to “union” and MARRIED is equal to “single”, and so on.
The @expand function can be used as part of a mathematical expression, so that a
command of:
group g3 2*@expand(union)
will create a group where the first series contains a 2 where-ever UNION is equal to
“union”. Further,
group g4 log(income)*@expand(married)
creates a group where the first series is equal to the values of the log of INCOME
where-ever MARRIED is equal to “married” and so on.
The of the most useful applications of the @expand function is when specifying an
equation object, since it can be used to automatically create dummy variables.
See also “Automatic Categorical Dummy Variables” for additional discussion.
An Illustration
Auto-series and group processing provides you with a powerful set of tools for working
with series data. As we saw above, auto-series provide you with dynamic updating of
expressions. If we use the auto-series expression:
log(y)
the result will be automatically updated whenever the contents of the series Y
changes.
A potential drawback of using auto-series is that expressions may be quite lengthy.
For example, the two expressions:
log(gdp)/price + d(invest) * (cons + invest)
12345.6789 * 3.14159 / cons^2 + dlog(gdp)
are not suited to use as auto-series if they are to be used repeatedly in other
expressions.
You can employ group access to make this style of working with data practical. First,
create groups containing the expressions:
group g1 log(gdp)/price+d(invest)*(cons+invest)
group g2 12345.6789*3.14159/cons^2+dlog(gdp)
If there are spaces in the expression, the entire contents should be enclosed in
parentheses.
You can now refer to the auto-series as G1(1) and G2(1). You can go even further by
combining the two auto-series into a single group:
group myseries g1(1) g2(1)
and then referring to the series as MYSERIES(1) and MYSERIES(2). If you wish to
skip the intermediate step of defining the subgroups G1 and G2, make certain that
there are no spaces in the subexpression or that it is enclosed in parentheses. For
example, the two expressions in the group ALTSERIES,
group altseries (log(gdp)/price) 3.141*cons/price
may be referred to as ALTSERIES(1) and ALTSERIES(2).
Scalars
Scalar objects are different from series and groups in that they hold a single number
instead of data for each observation in the sample. Scalars are created by commands
of the form:
scalar scalar_name = number
where you assign a number to the scalar name. The number may be an expression
or special functions that return a scalar.
To examine the contents of a scalar, you may enter the command show, followed by
the name of the scalar. For example:
scalar logl1 = eq1.@logl
show logl1
stores the log likelihood value of the equation object named EQ1 in a scalar named
LOGL1, and displays the scalar window.
VII. Working with Data (Advanced)
In addition to the basic tools for working with numeric data outlined in “Working with
Data,” EViews provides additional tools and objects for more advanced data handling,
or for working with different kinds of data.
• “Auto-Updating Series”
• “Alpha Series”
• “Date Series”
• “Value Maps”
Auto-Updating Series
One of the most powerful features of EViews is the ability to use a series expression
in place of an existing series. These expressions generate auto-series in which the
expression is calculated when in use, and automatically recalculated whenever the
underlying data change, so that the values are never out of date.
Auto-series are designed to be discarded after use. The resulting downside to auto-
series is that they are quite transitory. You must, for example, enter the expression
wherever it is used; for example, you must type “LOG(X)” every time you wish to use
an auto-series for the logarithm of X. For a single use of a simple expression, this
requirement may not be onerous, but for more complicated expressions used in
multiple settings, repeatedly entering the expression quickly becomes tedious.
For more permanent series expression handling, EViews provides you with the ability
to define a series or alpha object that uses a formula. The resulting auto-updating
series is simply an EViews numeric series or alpha series that is defined, not by the
values currently in the object, but rather by an expression that is used to compute the
values. In most respects, an auto-updating series may simply be thought of as a
named auto-series. Indeed, naming an auto-series is one way to create an auto-
updating series.
The formula used to define an auto-series may contain any of the standard EViews
series expressions, and may refer to series data in the current workfile page, or in
EViews databases on disk. It is worth emphasizing that in contrast with link objects,
which also provide dynamic updating capabilities, auto-updating series are designed
to work with data in a single workfile page.
Auto-updating series appear in the workfile with a modified version of the series or
alpha series icon, with the numeric series icon augmented by an “=” sign to show that
it depends upon a formula.
Defining an Auto-Updating Series
Using the Dialog
To turn a ordinary series into an auto-updating series, you will assign an expression
to the series and tell EViews to use this expression to determine the series values.
Simply click on the Properties button on the series or alpha series object toolbar, or
select View/Properties... from the main menu, then select the Values tab.
There are three radio buttons which control the values that will be placed in the
numeric or alpha series (“Alpha Series”). The default setting is either Numeric data or
Alphanumeric (text) data (depending on the series type) in which the series is defined
by the values currently in the series; this is the traditional way that one thinks of
defining a numeric or alpha series.
If instead you select Formula, enter a valid series expression in the dialog box, and
click on OK, EViews will treat the series as an auto-updating series and will evaluate
the expression, putting the resulting values in the series. Auto-updating numeric series
appear with a new icon in the workfile—a slightly modified version of the standard
series icon, featuring the series line with an extra equal sign, all on an orange
background.
Lastly, External link indicates that the series is linked to data found outside of EViews
as described in the link specification. You will be prompted to update data in external
links whenever the workfile is opened, and you may update the external series links
on demand by right-clicking on the series, and selecting Update... or clicking on CTRL-
F5.
In this example, we instruct EViews that the existing series LOGTAXRT should be an
auto-updating series that contains the natural logarithm of the TAXRATE2 series. As
with an auto-series expression, the values in LOGTAXRT will never be out of date
since they will change to reflect changes in TAXRATE2. In contrast to an auto-series,
however, LOGTAXRT is a permanent series in the workfile which may be used like
any other series.
Alternately, you may create an auto-updating series that links to a series in a external
file or database by selecting External link. In contrast to an auto-updating series based
on a formula which updates whenever the underlying data change, an auto-updating
series based on an external link will update only when the workfile is first loaded (you
will be prompted for whether to refresh the data series or not) or when you manually
update the links by clicking on Object/Manage Links & Formulae... in the workfile
window, then either selecting the source database above or selecting the individual
objects that are linked to that database and then clicking the associated Refresh
button. You may also update the link by selecting Update... in the series Object menu.
You may, at any time, change an auto-updating series into an standard numeric series
by bringing up the Values page of the Properties dialog, and clicking on the Numeric
data setting. EViews will define then define the series by its current values. In this way
you may freeze the formula series values at their existing values, a procedure that is
equivalent to performing a standard series assignment using the provided expression.
Note that once an expression is entered as a formula in a series, EViews will keep the
definition even if you specify the series by value. Thus, you make take a series that
has previously been frozen, and return it to auto-updating by selecting Formula
definition.
Issuing a Command
To create an auto-updating series using commands, you should use the formula
keyword, frml, followed by an assignment statement. The following example creates
a series named LOW that uses a formula to compute values. The auto-updating series
takes the value 1 if either INC is less than or equal to 5000 or EDU is less than 13,
and takes the value 0 otherwise:
frml low = inc<=5000 or edu<13
LOW is now an auto-updating series that will be reevaluated whenever INC or EDU
change.
You may also define auto-updating alpha series using the frml keyword. If
FIRST_NAME and LAST_NAME are alpha series, then the declaration:
frml full_name = first_name + " " + last_name
creates an auto-updating alpha series, FULL_NAME.
The same syntax should be used when you wish to apply a formula to an existing
series.
series z = rnd
frml z =(x+y)/2
makes Z an auto-updating series that contains the average of series X and Y. Note
that the previous values of Z are replaced, and obviously lost. Similarly, we may first
define an alpha series and then apply an updating formula:
alpha a = "initial value"
frml a = @upper(first_name)
You may not, however, apply an alpha series expression to a numeric series, or vice
versa. Given the series Z and A defined above, the following two statements:
frml z = @upper(first_name)
frml a = (x+y)/2
will generate errors.
Note that once a numeric series or alpha series is defined to be auto-updating, its
values may not be modified directly, since they are determined from the formula. Thus,
if Z is an auto-updating series, the assignment command:
z = log(x)
will generate an error since an auto-updating series may not be modified. To modify Z
you must either issue a new frml assignment or you must first set the values of Z to
their current values by turning off auto-updating, and then issue the assignment
statement.
To reset the formula in Z, you may simply issue the command:
frml z = log(x)
to replace the formula currently in the series.
To turn off auto-updating for a series, you may use the special expression “@CLEAR”
in your frml assignment. When you turn off auto-updating, EViews freezes the
numbers or strings in the series at their current values. Once the series is set to current
values, it is treated as an ordinary series, and may be modified as desired. Thus, the
commands:
frml z = @clear
z = log(x)
are allowed since Z is converted into an ordinary series prior to performing the series
assignment.
Alternately, you may convert a named auto-updating series into an ordinary series by
selecting Object/Manage Links & Formulae... from the workfile window and using the
dialog to break the links in the auto-updating series.
One particularly useful feature of auto-updating series is the ability to reference series
in databases. The command:
frml gdp = usdata::gdp
creates a series in the workfile called GDP that gets its values from the series GDP in
the database USDATA. Similarly:
frml lgdp = log(usdata::gdp)
creates an auto-updating series named LGDP that contains the log of the values of
GDP in the database USDATA.
Series that reference data in databases may be refreshed each time a workfile is
loaded from disk. Thus, it is possible to setup a workfile so that its data are current
relative to a shared database.
Naming an Auto-Series
If you have previously opened a window containing an ordinary auto-series, you may
convert the auto-series into an auto-updating series by assigning a name. To turn an
auto-series into an auto-updating series, simply click on the Name button on the
toolbar, or select Object/Name... from the main menu, and enter a name. EViews will
assign the name to the series object, and will apply the auto-series definition as the
formula to use for auto-updating.
Suppose, for example, that you have opened a series window containing an auto-
series for the logarithm of the series CP by clicking on the Show button on the toolbar,
or selecting Quick/Show… and entering “LOG(CP)”. Then, simply click on the Name
button in the auto-series toolbar, and assign a name to the temporary object to create
an auto-updating series in the workfile.
Additional Issues
Auto-updating series are designed to calculate their values when in use, and
automatically update values whenever the underlying data change. An auto-updating
series will assign a value to every observation in the current workfile, irrespective of
the current values of the workfile sample.
In most cases, there is no ambiguity in this operation. For example, if we have an auto-
updating series containing the expression “LOG(CP)”, we simply take each
observation on CP in the workfile, evaluate the log of the value, and use this as the
corresponding auto-updating series value.
However, in cases where the auto-updating series contains an expression involving
descriptive statistics, there is ambiguity as to whether the sample used to calculate
the values is the sample at the time the auto-updating series was created, the sample
at the time the series is evaluated, the entire workfile range, or some other sample.
To resolve this ambiguity, EViews will enter the current workfile sample into the
expression at the time the auto-updating series is defined. Thus, if you enter
“@MEAN(CP)” as your auto-updating series expression, EViews will substitute an
expression of the form “@MEAN(CP, smpl)” into the definition. If you wish to evaluate
the descriptive statistics for a given sample, you should enter an explicit sample in
your expression.
Alpha Series
An alpha series object contains a set of observations on alphanumeric string values.
Alpha series should be used when you wish to work with variables that contain
alphanumeric data, such as names, addresses, and other text. If any of these types
of data were entered into an ordinary series, EViews will replace the string with the
numeric missing value, NA.
You may, for example, have an alpha series that contains the two-character U.S.
Postal Service abbreviations for the 50 states, D.C., and Puerto Rico. Here, we show
the alpha series, STATE, that contains the appropriate 2-character string values.
STATE will be identified in the workfile with the alpha series icon labeled “abc”, and
by the designation Alpha in the titlebar of the alpha series window.
Similarly, alpha series may be used to hold identifying information such as the names
and addresses of individuals, social security and telephone numbers, or classifying
labels such as “male” and “female”, or “high”, “medium”, and “low”.
Declaring an Alpha Series
To create a new alpha series, you may select Object/New Object... from the main
EViews window or workfile button bar, and then click on Series Alpha and optionally
enter a name to be given to your alpha series. If you provide a name, EViews will
create a new alpha series object in the workfile. If you do not supply a name, EViews
will open an UNTITLED alpha series window.
Alternatively, you may type the keyword “ALPHA”, followed by an optional series
name, in the command window. The command:
alpha
will create a new untitled alpha series and will display the series in an object window.
Likewise:
alpha myseries
will create a new alpha series MYSERIES. To open the alpha series windows for
MYSERIES or SETSERIES, simply double-click on the corresponding alpha series
icon in the workfile window directory, or enter the command “SHOW MYSERIES”.
In both of the cases described above, the alpha series will be initialized to contain
missing values. For alpha series, the empty string (the null string, “”) is used to
designate a missing value. If you are declaring an alpha series using a command, you
may combine the declaration with the assignment of the values in the series. We
explore alpha series assignment in “Assigning values to Alpha Series”.
For the most part, you need not worry about the lengths of string values in your alpha
series since EViews will automatically resize your series as required, up to the limit
specified in the global defaults. Beyond that point, EViews will truncate the values of
the alpha series. To modify the truncation length, select Options/General Options...
from the main menu and go to the Series and Alphas/Alpha truncation page. Enter the
desired length, and subsequent alpha series creation and assignment will use the new
truncation length.
You should bear in mind that the strings in EViews alpha series are of fixed length so
that the size of each observation is equal to the length of the longest string. If you have
a series with all short strings with the exception of one very long string, the memory
taken up by the series will be the number of observations times the longest string. In
settings of this sort, efficiency suggests that you consider using value maps (“Value
Maps”) to encode the values of the long string.
Editing an Alpha Series
There is no difference between editing an ordinary numeric series and editing an alpha
series. Make certain that the alpha series is in edit mode by verifying the existence of
the edit field in the series window. If not, click on the Edit +/– button to enable edit
mode.
To edit a specific value, click on the desired cell. The existing value in the cell will
appear in the edit window for you to modify or delete.
Simply type the new value in the edit window. Once you have entered the desired
value, move to a new cell by clicking or using the arrow keys, or press the return key.
This action will accept the entered value and prepare you for editing the newly selected
cell.
Note that when editing the values of an alpha series, EViews does not require you to
delimit your strings. You may simply type the relevant value in the edit field. EViews
will remove any leading and trailing spaces from the value that you enter; if you wish
to retain those characters, enclose your string in double quotes. To enter the double
quote character as a part of your string, you should escape the character with another
double quote so that you enter two consecutive double quotes.
Assigning values to Alpha Series
You may assign values to an alpha series using string expressions. An alpha series
assignment has the form:
alpha_name = string_expr
where alpha_name is the name of an existing alpha series and string_expr is any
expression containing a combination of string literals, alpha series, and functions or
operators that return strings (see “Strings”for details). As with ordinary series, we may
combine the declaration and assignment steps so that the commands:
alpha alpha_name = string_expr
or
genr alpha_name = string_expr
first create the alpha series alpha_name and then will assign the values using
string_expr. In the latter command, EViews notes that the right-hand side expression
is a string so that it knows to create an alpha series.
Alternatively, assuming that the alpha series exists, you may reassign the series
values by clicking on Quick/Generate Series... in the main menu and entering the
assignment and sample statements in the dialog. For example, if you enter the
expression:
myalpha = string_expr
in the dialog, EViews will assign the values of the string_expr to the existing alpha
series MYALPHA. Alternatively, you may enter the expression in the command line.
In both cases, EViews will assign the corresponding values for all observations in the
current workfile sample, overwriting the existing values.
Let us consider a simple example. Suppose that we have data on the company name
(NAME), ticker symbol (SYMBOL), time of last trade (LAST_TIME), and closing price
(LAST_TRADE) for each of the stocks in the Dow Jones Industrial Average on
September 10, 2003.
Clicking on the icon for NAME, we can display the alpha series spreadsheet view.
Note here that the default column width is not wide enough to display the contents of
every observation, a condition that is signaled by the trailing “...” in the display for
several of the observations. We may increase the column width by dragging the
column header separators (the lines separating the column headers located just below
the name of the series), by clicking on the Properties button and entering a larger
number in the width field, or by double clicking on the column header separator to
adjust the column width to the minimum width that displays all of the observation
values without truncation.
Suppose now that we wish to create an alpha series containing the name of each
company followed by its ticker symbol (enclosed in parentheses). A simple assignment
statement generates the desired series:
alpha namesymb = name + " (" + symbol + ")"
EViews will create a new alpha series NAMESYMB if one doesn’t exist. Then, for
every observation in the workfile sample, the contents of the alpha series NAME are
concatenated with the literal strings for the parentheses, and the contents of the
SYMBOL series.
Working with Alpha Series
Once created, an alpha series is used in two primary ways: (1) to generate numeric
values and (2) to provide identifiers for the observations in the workfile.
Generating Numeric Values
By definition, an alpha series contains a string value for each observation. This means
that if you use an alpha series in a setting requiring numeric input, all of the values of
the alpha series will be treated as NAs. For example, if you attempt to compute the
mean of the STATE alpha series or use the Dow company NAME in an equation
regression specification, EViews will generate an error saying that there are an
insufficient number of observations, since all of the numeric values are missing.
You may, however, use the string relational operators (see “String Relational
Operators”) to generate a series of numeric values. For the data from our Dow Jones
example, the commands:
smpl @all
series wname = (@lower(@left(NAME, 1)) = "w")
generate the numeric series WNAME containing the value 1 if the company name
begins with the letter “W”, and 0 otherwise.
Similarly, the relational operators may be used when specifying a subsample. The
command:
smpl @all if gender = "Male"
will restrict the workfile sample to include only observations where the string value in
the alpha series GENDER is “Male”.
You may also use the various functions described in “String Information Functions”to
generate numeric values.
Two examples are of particular importance. First, you may have an alpha series that
contains string representations of numbers, such as “3.14159”. In order to use the
strings as actual numbers, you must translate them into numbers, using either the
string evaluation function @val.
Suppose, in our Dow Jones example, that we have the alpha series CHANGE
containing information on the stock price change, expressed in both levels and
percentages.
If we wish to extract only the levels information from the alpha series, the @left function
may be used to extract the leftmost four characters of each string. The @val function
may then be used to obtain the numeric value for each observation. Putting this
together, the command:
series chgval = @val(@left(change, 4))
converts the leading four characters of the CHANGE series into numeric values, and
places the results in the series CHGVAL.
Second, you may have an alpha series that contains a text representation of dates.
Here, we have a series DATES that contains text representations of dates in “dd-Mon-
YY” format (one or two-digit day, dash, three-character month abbreviation, dash, two-
digit year). For example, “12-Jun-03” represents June 12, 2003.
To convert every element of this series into a numeric series containing date values,
simply issue the command:
series dval = @dateval(dates)
The newly created series DVAL will contain date numbers associated with each of the
string values in DATES.
Additional Issues
The Spreadsheet View
By default, the alpha series spreadsheet will display your data left-justified, with a
column width of approximately 12 characters. You may change the justification and
column width settings by clicking on the Properties button in the toolbar, then selecting
a new justification setting and entering a new column width. Alternatively, the column
width may be changed by dragging the separator in the column header to the desired
position, or by double-clicking on the separator to adjust the column width to the
minimum width that displays all of the observation values without truncation.
Auto-series
You should note that like ordinary series, you may also work directly with a series
expression that produces an alpha series. For example, if ALPHA1 is an alpha series,
the command:
show @lower(alpha1)
will result in an alpha series containing the contents of ALPHA1 with the text converted
to all lowercase characters.
Auto-series expressions involving alpha series may also evaluate to ordinary series.
For example, if NUMER1 is a numeric series and ALPHA1 is an alpha series, you may
enter:
show numer1+@len(alpha1)+(alpha1>"cat")
to open a series window containing the results of the operation. Note that the
parentheses around the relational comparison are required for correct parsing of the
expression.
Date Series
A date series is a standard EViews numeric series that contains valid date values (see
“Dates”). There is nothing that distinguishes a date series from any other numeric
series, except for the fact that the values it contains may be interpreted as dates.
Creating a Date Series
There is nothing special about creating a date series. Any method of creating an
EViews series may be used to create a numeric series that will be used as a date
series.
Displaying a Date Series
The numeric values in a date series are generally of interest only when performing
calendar operations. For most purposes, you will wish to see the values of your date
series as date strings.
For example, the following series QDATES in our quarterly workfile is a numeric series
containing valid date values for the start of each quarter. The numeric values of
QDATES depicted here show the number of days since 1 January A.D. 1.
Obviously, this is not the way that most people will wish to view their date series.
Accordingly, EViews provides considerable control over the display of the date values
in your series. To change the display, click on the Properties button in the series
toolbar, or select View/Properties... from the main menu.
EViews will display a dialog prompting you to change the display properties of the
series. While you may change a variety of display settings such as the column width,
justification, and indentation, here, for the moment, we are more interested in setting
the properties of the Numeric Display.
For a date series, there are four settings of interest in the Numeric Display dropdown
menu (Period, Day, Day-Time, and Time), with each corresponding to specific
information that we wish to display in the series spreadsheet. For example, the Day
selection allows you to display date information up to the day in various formats; with
year, month, and day all included in the representation.
Let us consider our quarterly workfile example. Here we have selected Period and
chosen a specific Date format entry (“YYYY[Q]Q”), which tells EViews that you wish
to display the year, followed by the “Q” separator, and then the quarter number. Note
also that when Period is selected, there is a Current Workfile setting in the Date format
dropdown menu which tells EViews to use the current workfile display settings.
The two checkboxes below the Date format dropdown menu may be used to modify
the selected date format. If you select Two digit year, EViews will only display the last
two-digits of the year (if the selected format is “YYYY[Q]Q”, the actual format used will
be “YY[Q]Q”); if you select Day/month order, days will precede months in whichever
format is selected (if you select “mm/dd/YYYY” as the format for a day display, EViews
will use “dd/mm/YYYY”).
Applying this format to the QDATES series, the display changes to show the data in
the new format:
If instead we select the Day display, and choose the “YYYY-MM-DD” format, the
QDATES spreadsheet will show:
There is one essential fact to remember about the QDATES series. Despite the fact
that we have changed the display to show a text representation of the date, QDATES
still contains the underlying numeric date values. This is in contrast to using an alpha
series to hold a text representation of the date.
If you wish to convert a (numeric) date series into an alpha series, you will need to use
the @datestr function. If you wish to convert an alpha series into a numeric date series,
you will need to use the @dateval function. See “Translating between Date Strings
and Date Numbers” for details.
Editing a Date Series
You may edit a date series either by either date numbers, or if the series is displayed
using a date format, by entering date strings directly.
Suppose, for example, that we have our date series from above and that we wish to
change a value. If we are displaying the series with date formatting, we may enter a
date string, which EViews will automatically convert into a date number.
For example, we may edit our QDATES series by entering a valid date string (“April
10, 1992”), which EViews will convert into a date number (727297.0), and then display
as a date string (“1992-04-10”). See “Free-format Conversion” for details on automatic
translation of strings to date values.
Note, however, that if we were to enter the same string value in the series when the
display is set to show numeric values, EViews will not attempt to interpret the string
and will enter an NA in the series.
Value Maps
You may use the valmap object to create a value map (or map, for short) that assigns
descriptive labels to values in numeric or alpha series. The practice of mapping
observation values to labels allows you to hold your data in encoded or abbreviated
form, while displaying the results using easy-to-interpret labels.
Perhaps the most common example of encoded data occurs when you have
categorical identifiers that are given by integer values. For example, we may have a
numeric series FEMALE containing a binary indicator for whether an individual is a
female (1) or a male (0).
Numeric encodings of this type are commonly employed, since they allow one to work
with the numeric values of FEMALE. One may, for example, compute the mean value
of the FEMALE variable, which will provide the proportion of observations that are
female.
On the other hand, numeric encoding of categorical data has the disadvantage that
one must always translate from the numeric values to the underlying categorical data
types. For example, a one-way tabulation of the FEMALE data produces the output:
Interpretation of this output requires that the viewer remember that the FEMALE series
is encoded so that the “0” value represents “Male” and the “1” represents “Female”.
The example above would be easier to interpret if the first column showed the text
representations of the categories in place of the numeric values.
Valmaps allow us to combine the benefits of descriptive text data values with the ease
of working with a numeric encoding of the data. In cases where we define value maps
for alphanumeric data, the associations allow us to use space saving abbreviations
for the underlying data along with more descriptive labels to be used in presenting
output.
Defining a Valmap
To create a valmap object, select Object/New Object.../ValMap from the main menu
and optionally enter an object name, or enter the keyword “VALMAP” in the command
line, followed by an optional name. EViews will open a valmap object.
You will enter your new mappings below the double line by typing or by copy-and-
pasting. In the Value column, you should enter the values for which you wish to provide
labels; in the Label column, you will enter the corresponding text label. Here, we define
a valmap named FEMALEMAP in which the value 0 is mapped to the string “Male”,
and the value 1 is mapped to the string “Female”.
The two special entries above the double line should be used to define mappings for
blank strings and numeric missing values. The default mapping is to represent blank
strings as themselves, and to represent numeric missing values with the text “NA”.
You may change these defaults by entering the appropriate text in the Label column.
For example, to change the representation of missing numeric values to, say, a period,
simply type the “.” character in the appropriate cell.
We caution that when working with maps, EViews will look for exact equality between
the value in a series and the value in the valmap. Such an equality comparison is
subject to the usual issues associated with comparing floating point numbers. To
mitigate these issues and to facilitate mapping large numbers of values, EViews allows
you to define value maps using intervals.
To map an interval, simply enter a range of values in the Value column and the
associated label in the Label column. You may use round and square parentheses, to
denote open (“(“, “)“) or closed (“[“, “]”) interval endpoints, and the special values “–
INF” and “INF” to represent minus and plus infinity.
Using interval mapping, we require only three entries to map all of the negative values
to the string “negative”, the positive values to the string “positive”, and the value 0 to
the string “zero”. Note that the first interval in our example, “[–inf, 0)”, is mathematically
incorrect since the lower bound should not be closed, but EViews allows the closed
interval syntax in this case since there is no possibility of confusion.
While the primary use for valmaps will be to map numeric series values, there is
nothing stopping you from defining labels corresponding to alpha series values (note
that value and label matching is case sensitive). One important application of string
value mapping is to expand abbreviations. For example, one might wish to map the
U.S. Postal Service state abbreviations to full state names.
Since valmaps may be used with both numeric and alpha series, the text entries in the
Value column may generally be used to match both numeric and alphanumeric values.
For example, if you enter the text “0” as your value, EViews treats the entry as
representing either a numeric 0 or the string value “0”. Similarly, entering the text string
“[0,1]” will match both numeric values in the interval, as well as the string value “[0,1]”.
There is one exception to this dual interpretation. You may, in the process of defining
a given valmap, provide an entry that conflicts with a previous entry. EViews will
automatically identify the conflict, and will convert the latter entry into a string-only
valmap entry.
For example, if the first line of your valmap maps 0 to “Zero”, a line that maps 0 to
“New Zero”, or one that maps “[0, 1]” to “Unit interval” conflicts with the existing entry.
In the latter cases, the conflicting maps will be treated as text maps. Such a map is
identified by enclosing the entry with quotation marks. Here, EViews has automatically
added the enclosing quotation marks to indicate that the latter two label entries will
only be interpreted as string maps, and not as numeric maps.
Once you have defined your mappings, click on the Update button on the toolbar to
validate the object. EViews will examine your valmap and will remove entries with
values that are exact duplicates. In this example, the last entry, which maps the string
“0” to the value “New Zero” will be removed since it conflicts with the first line. The
second entry will be retained since it is not an exact duplicate of any other entry. It will,
however, be interpreted only as a string since the numeric interpretation would lead to
multiple mappings for the value 0.
Assigning a Valmap to a Series
To use a valmap, you need to instruct EViews to display the values of the map in place
of the underlying data. Before working with a valmap, you should be certain that you
have updated and validated your valmap by pressing the Update button on the valmap
toolbar.
First, you must assign the value map to your series by modifying the series properties.
Open the series window and select View/Properties... or click on the Properties button
in the series toolbar to open the properties dialog. Click on the Value Map tab to
display the value map name edit field.
If the edit field is blank, a value map has not been associated with this series. To
assign a valmap, simply enter the name of a valmap object in the edit field and click
on OK.
EViews will validate the entry and apply the specified map to the series. Note that to
be valid, the valmap must exist in the same workfile page as the series to which it is
assigned.
Using the Valmap Tools
EViews provides a small set of object-specific views and procedures that will aid you
in working with valmaps.
Sorting Valmap Entries
You may add your valmap entries in any order without changing the behavior of the
map. However, when viewing the contents of the map, you may find it useful to see
the entries in sorted order.
To sort the contents of your map, click on Proc/Sort... from the main valmap menu.
EViews provides you with the choice of sorting by the value column using numeric
order (Value - Numeric), sorting by the value column using text order (Value - Text) or
sorting by the label column (Label).
In the first two cases, we sort by the values in the first column of the valmap. The
difference between the choices is apparent when you note that the ordering of the
entries “9” and “10” depends upon whether we are interpreting the sort as a numeric
sort, or as a text sort. Selecting Value - Numeric tells EViews that, where possible,
you wish to interpret strings as numbers when performing comparisons (so that “9” is
less than “10”); selecting Value - Text says that all values should be treated as text for
purposes of comparison (so that “10” is less than “9”).
Click on OK to accept the sort settings.
Examining Properties of a Valmap
You may examine a summary of your valmap by selecting View/Statistics in the
valmap window. EViews will display a view showing the properties of the labels
defined in the object.
The top portion of the view shows the number of mappings in the valmap, and the
number of unique labels used in those definitions. Here we see that the valmap has
four definitions, which map four values into four unique labels. Two of the four
definitions are the special entries for blank strings and the numeric NA value.
The remaining portions of the view provide a detailed summary of the valmap
describing the properties of the map when applied to numeric and to text values.
When applied to an ordinary numeric series, our FEMALEMAP example contains
three relevant definitions that provide labels for the values 0, 1, and NA. Here, EViews
reports that the numeric value mapping is one-to-one since there are no two values
that produce the same value label.
The output also reports that the FEMALEMAP has three relevant definitions for
mapping the three text values, “0”, “1”, and the blank string, into three unique labels.
We see that the text interpreted maps are also one-to-one.
Note that in settings where we map an interval into a given label, or where a given text
label is repeated for multiple values, EViews will report a many-to-one mapping.
Knowing that a valmap is many-to-one is important since it implies that the values of
the underlying source series are not uniquely identified by the label values. This lack
of identification has important implications in editing mapped series and in interpreting
the results from various statistical output (see “Editing a Mapped Series” and “Valmap
Definition Cautions”).
Tracking Valmap Usage
A single valmap may be applied to more than one series. You may track the usage of
a given valmap by selecting View/Usage from the valmap main menu. EViews will
examine every numeric and alpha series in the workfile page to determine which, if
any, have applied the specified valmap.
The valmap view then changes to show the number and names of the series that
employ the valmap, with separate lists for the numeric and the alpha series. Here we
see that there is a single numeric series named FEMALE that uses FEMALEMAP.
Working with a Mapped Series
Once you assign a map to a series, EViews allows you to display and edit your series
using the mapped values and will use the labels when displaying the output from
selected procedures.
Displaying series values
By default, once you apply a value map to a series, the EViews spreadsheet view will
change to display the newly mapped values.
For example, after applying the FEMALEMAP to our FEMALE series, the series
spreadsheet view changes to show the labels associated with each value instead of
the underlying encoded values. Note that the display format dropdown menu usually
visible in series toolbar indicates that EViews is displaying the Default series values,
so that it shows the labels “Male” and “Female” rather than the underlying 0 and 1
values.
Note that if any of the values in the series does not have a corresponding valmap
entry, EViews will display a mix of labeled and unlabeled values, with the unlabeled
value “showing through” the mapping. For example, if the last observation in the
FEMALE series had the value 3, the series spreadsheet will show observations with
“Male” and “Female” corresponding to the mapped values, as well as the unmapped
value 3.
There may be times when you wish to view the underlying series values instead of the
labels. There are two possible approaches. First, you may remove the valmap
assignment from the series. Simply go to the Properties dialog and delete the name
of the valmap object from the Value Map page. The display will revert to showing the
underlying values. Less drastically, you may use the display method dropdown menu
to change the display format for the spreadsheet view. If you select Raw Data, the
series spreadsheet view will change to show the underlying series data.
Editing a Mapped Series
To edit the values of your mapped series, first make certain you are in edit mode, then
enter the desired values, either by typing in the edit field, or by pasting from the
clipboard. How EViews interprets your input will differ depending upon the current
display format for the series.
If your mapped series is displayed in its original form using the Raw Data setting,
EViews will interpret any input as representing the underlying series values, and will
place the input directly into the series. For example, if our FEMALE series is displayed
using the Raw Data setting, any numeric input will be entered directly in the series,
and any string input will be interpreted as an NA value.
In contrast, if the series is displayed using the Default setting, EViews will use the
attached valmap both in displaying the labeled values and in interpreting any input. In
this setting, EViews will first examine the attached valmap to determine whether the
given input value is also a label in the valmap. If a matching entry is found, and the
label matches a unique underlying value, EViews will put the value in the series. If
there is no matching valmap label entry, or if there is an entry but the corresponding
value is ambiguous, EViews will put the input value directly into the series. One
implication of this behavior is that so long as the underlying values are not themselves
valmap labels, you may enter data in either mapped or unmapped form. Note, again,
that text value and label matching is case-sensitive.
Similarly, when computing descriptive statistics for the SALES data categorized by the
values of the FEMALE series, we have:
Valmap Functions
To facilitate working with valmaps, three new genr functions are provided which allow
you to translate between unmapped and mapped values. These functions may be
used as part of standard series or alpha expressions.
First, to obtain the mapped values corresponding to a set of numbers or strings, you
may use the command:
@map(arg[, map_name])
where arg is a numeric or string series expression or literal, and the optional
map_name is the name of a valmap object. If map_name is not provided, EViews will
attempt to determine the map by inspecting arg. This attempt will succeed only if arg
is a numeric series or alpha series that has previously been mapped.
Let us consider our original example where the FEMALEMAP maps 0 to “Male” and 1
to “Female”. Suppose that we have two series that contain the values 0 and 1. The
first series, MAPPEDSER, has previously applied the FEMALEMAP, while the latter
series, UNMAPPEDSER, has not.
Then the commands:
alpha s1 = @map(mappedser)
alpha s2 = @map(mappedser, femalemap)
are equivalent. Both return the labels associated with the numeric values in the series.
The first command uses the assigned valmap to determine the mapped values, while
the second uses FEMALEMAP explicitly.
Alternately, the command:
alpha s3 = @map(unmappedser)
will generate an error since there is no valmap assigned to the series. To use @map
in this context, you must provide the name of a valmap, as in:
alpha s4 = @map(unmappedser, femalemap)
which will return the mapped values of UNMAPPEDSER, using the valmap
FEMALEMAP.
Conversely, you may obtain the numeric values associated with a set of string value
labels using the @unmap function. The @unmap function takes the general form:
@unmap(arg, map_name)
to return the numeric values that have been mapped into the string given in the string
expression or literal arg, where map_name is the name of a valmap object. Note that
if a given label is associated with multiple numeric values, the missing value NA will
be returned. Note that the map_name argument is required with the @unmap function.
Suppose, for example, that you have an alpha series STATEAB that contains state
abbreviations (“AK”, “AL”, etc.) and a valmap STATEMAP that maps numbers to the
abbreviations. Then:
series statecode = @unmap(stateab, statemap)
will contain the numeric values associated with each value of STATEAB.
Similarly, you may obtain the string values associated with a set of string value labels
using:
@unmaptxt(arg, map_name)
where arg is a string expression or literal, and map_name is the name of a valmap
object. @unmaptxt will return the underlying string values that are mapped into the
string labels provided in arg. If a given label is associated with multiple values, the
missing blank string “” will be returned.
Valmap Definition Cautions
EViews allows you to define quite general value maps that may be used with both
numeric and alpha series. While potentially useful, the generality comes with a cost,
since if used carelessly, valmaps can cause confusion. Accordingly, we caution you
that there are many features of valmaps that should be used with care. To illustrate
the issues, we list a few of the more problematic cases.
Many-to-one Valmaps
A many-to-one valmap is a useful tool for creating labels that divide series values into
broad categories. For example, you may assign the label “High” to a range of values,
and the label “Low” to a different range of values so that you may, when displaying
the series labels, easily view the classification of an observation.
The downside to many-to-one valmaps is that they make interpreting some types of
output considerably more difficult. Suppose, for example, that we construct a valmap
in which several values are mapped to the label “Female”. If we then display a one-
way frequency table for a series that uses the valmap, the label “Female” may appear
as multiple entries. Such a table is almost impossible to interpret since there is no way
to distinguish between the various “Female” values.
A series with an attached many-to-one valmap is also more difficult to edit when
viewing labels since EViews may be unable to identify a unique value corresponding
to a given label. In these cases, EViews will assign a missing value to the series, which
may lead to confusion (see “Editing a Mapped Series”).
Mapping Label Values
Defining a map in which one of the label values is itself a value that is mapped to a
label can cause confusion. Suppose, for example, that we have a valmap with two
entries: the first maps the value 6 to the label “six”, and the second maps the value
“six” to the label “high”.
Now consider editing an alpha series that has this valmap attached. If we use the
Default display, EViews will show the labeled values. Thus, the underlying value “six”
will display as the value “high”; while the value “6” will display as “six”. Since the string
“six” is used both as a label and as a value, in this setting we have the odd result that
it must be entered indirectly. Thus, to enter the string “six” in the alpha series, we have
the counterintuitive result that you must type “high” instead of “six”, since entering the
latter value will put “6” in the series.
Note, however, that if you display the series in Raw Data form, all data entry is direct;
entering “six” will put the value “six” into the series and entering “high” will put the value
“high” in the series.
Mapping Values to Numbers
Along the same lines, we strongly recommend that you not define value maps in which
numeric values can be mapped to labels that appear to be numeric values. Electing,
for example, to define a valmap where the value 5 is mapped to the label “6” and the
value 6 is mapped to the label “5”, is bound to lead to confusion.
VIII. Series Links
The series link object (or link, for short) provides you with powerful tools for combining
information from different workfile pages. Links provide an easy-to-use interface to a
wide range of sophisticated data operations such as:
• merging data from one workfile page into another
• saving “by-group” summary statistics into a workfile page
• matching observations between dated workfile pages
• performing frequency conversion between regular dated workfile pages
Links operate both dynamically and on demand, so that the desired operation is
performed only when needed, and is updated automatically whenever your data
change.
Basic Link Concepts
You may find that working with links is in many ways similar to working with data tables
in a relational database management system. Indeed, links have specifically been
designed to provide much of the power of these sophisticated systems. But you need
not have worked with such a system to take advantage of the power, ease-of-use, and
flexibility associated with link objects.
Note that you may also use auto-series to work with data on other workfile pages. This
method is easier than creating a link object, but more limiting (“Auto-series Across
Pages”).
We begin with a discussion of basic link concepts that outlines the basic operations
supported by links. In later sections we document the use of links in EViews.
A link is a series-like object that exists in one workfile page, but “refers” to series data
in another workfile page. At a basic level, a link is a description of how EViews should
use data in a source workfile page to determine values of a series in the current, or
destination, workfile page.
A link contains three fundamental components:
• First, there is the name of a source series. The source series identifies the series in
the source workfile page that is used as a basis for obtaining values in the destination
page.
• Second, the link contains the names of one or more link identifier (ID) series in both
the source and destination pages. The source ID and destination ID series will be used
to match observations from the two pages.
• Lastly, the link contains a description of how the source series should be used to
construct link values for matching observations in the destination page.
The basic series link employs a method called match merging to determine the link
values in the destination page. More advanced links combine match merging with
automatic frequency conversion. We describe these two methods in detail below, in
“Linking by general match merging” and “Linking by date with frequency conversion”.
As the name suggests, the series link object shares most of the properties of a series.
You may, in fact, generally use a series link as though it were a series. You may
examine series views, perform series procedures, or use the series link to generate
new data, or you may use the link as a regressor in an equation specification.
Another important property of links is that they are “live”, in the sense that the values
in the link change as its underlying data change. Thus, if you have a link in a given
workfile page, the link values will automatically be updated when the source series or
ID series values change.
Lastly, links are memory efficient. Since links are computed and updated as needed,
the values of the series link are not held in memory unless they are in use. Thus, it is
possible to create a page populated entirely by links that takes up only the minimum
amount of memory required to perform all necessary operations.
Linking by general match merging
We begin our discussion of linking with a brief, and admittedly terse, description of
how a basic link with match merging works. More useful, perhaps, will be the extended
examples that follow.
The basic link first compares values for one or more source ID series with the values
in the destination ID series. Observations in the two pages are said to match if they
have identical ID values. When matches are observed, values from the source series
are used to construct values of the link for the corresponding observations in the
destination page.
Each link contains a description of how the source series should be used to construct
link values in the destination page. Constructing values for a basic match merge link
involves two steps:
• First, we perform a contraction of the source series to ensure that there is a single
value associated with each distinct source ID value. The contraction method employed
describes how the (possibly) multiple source series observations sharing a given ID
value should be translated into a single value.
• Next, we take the distinct source IDs and contracted source series values, and
perform a match merge in which each contracted value is repeated for all matching
observations in the destination page.
This basic method is designed to handle the most general cases involving many-to-
many match merging by first computing a many-to-one contraction (by-group
summary) of the source series, and then performing a one-to-many match merge of
the contracted data.
All other match merges are handled as special cases of this general method. For a
many-to-one match merge, we first compute the contraction, then perform one-to-one
matching of the contracted data into the destination page. In the more common one-
to-many or one-to-one match merge, the contraction step typically has no practical
effect since the standard contractions simply return the original source series values.
The original values are then linked into the destination page using a simple one-to-
one or one-to-many match merge.
While all of this may seem a bit abstract, a few simple examples should help to fix
ideas. Suppose first that we have a state workfile page containing four observations
on the series STATE1 and TAXRATE:
In the same workfile, we have a second workfile page containing individual level data,
with a name, NAME, state of residence, STATE2, and SALES volume for six
individuals:
We wish to link the data between the two pages. Note that in this example, we have
given the state series different names in the two pages to distinguish between the two.
In practice there is no reason for the names to differ, and in most cases, the names
will be the same.
One-to-many match merge
Our first task will be to create, in the page containing individual information, a series
containing values of the TAXRATE faced by every individual. We will determine the
individual rates by examining each individual’s state of residence and locating the
corresponding tax rate. George, for example, who lives in Arkansas, will face that
state’s tax rate of 0.030. Similarly, Mark, who lives in Texas, has a tax rate of 0.035.
We will use a series link to perform a one-to-many match merge in which we assign
the TAXRATE values in our source page to multiple individuals in our destination
page.
For the three basic components of this link, we define:
• the source series TAXRATE
• the source identifier STATE1 and destination identifier STATE2
• the merge rule that the values of TAXRATE will be repeated for every individual with
a matching STATE2 value in the destination page
This latter merge rule is always used for basic links involving one-to-many match
merges. Here, the rule leads to the natural result that each individual is assigned the
TAXRATE value associated with his or her state.
After performing the link, the individual page will contain the merged values for the tax
rate in TAXRATE2. We use the “2” in the TAXRATE2 name to denote the fact that
these data are generated by merging data using STATE2 as the destination ID series:
We mention one other issue in passing that will become relevant in later discussion.
Recall that all basic links with match merging first contract the source series prior to
performing the match merge. In this case, the specified merge rule implicitly defines a
contraction of the source series TAXRATE that has no effect since it returns the
original values of TAXRATE. It is possible, though generally not desirable, to define a
contraction rule which will yield alternate source values in a one-to-many match
merge. See “Link calculation settings”.
Many-to-one match merge
Alternatively, we may wish to link data in the opposite direction. We may, for example,
choose to link the SALES data from the individual page to the destination state page,
again matching observations using the two state IDs. This operation is a many-to-one
match merge, since there are many observations with STATE2 ID values in the
individual page for each of the unique values of STATE1 in the state page.
The components of this new link are easily defined:
• the source series SALES
• the source identifier STATE2 and destination identifier STATE1
• a merge rule stating that the values of SALES will first be contracted, and that the
contracted values will be placed in matching observations in the destination page
Specifying the last component, the merge rule, is a bit more involved here since there
are an unlimited number of ways that we may contract the individual data. EViews
provides an extensive menu of contraction methods. Obvious choices include
computing the mean, variance, sum, minimum, maximum, or number of observations
for each source ID value. It is worth noting here that only a subset of the contraction
methods are available if the source is an alpha series.
To continue with our example, suppose that we choose to take the sum of
observations as our contraction method. Then contraction involves computing the sum
of the individual observations in each state; the summary value for SALES in Arkansas
is 520, the value in California is 950, and the value in Texas is 290. Wyoming is not
represented in the individual data, so the corresponding contracted value is NA.
Given this link definition, the many-to-one match merge will result in a state page
containing the match merged summed values for SALES1:
Similarly, we may define a second link to the SALES data containing an alternative
contraction method, say the count of non-missing observations in each state. The
resulting link, SALES1CT, shows that there are two individual observations for each
of the first three states, and none for Wyoming.
Many-to-many match merge
Lastly, suppose that we have a third workfile page containing a panel structure with
state data observed over a two year period:
Linking the SALES data from the individual page to the panel page using the STATE2
and STATE3 identifiers involves a many-to-many match merge since there are
multiple observations for each state in both pages.
The components of this new link are easily defined:
• the source series SALES
• the source identifier STATE2 and destination identifier STATE3
• a merge rule stating that the values of SALES will first be contracted, and that the
contracted values will be repeated for every observation with a matching STATE3
value in the destination page
This merge rule states that we perform a many-to-many merge by first contracting the
source series, and then performing a one-to-many match merge of the contracted
results into the destination. For example, linking the SALES data from the individual
page into the panel state-year page using the sum and count contraction methods
yields the link series SALES3 and SALES3A:
It is worth noting that this many-to-many match merge is equivalent to first performing
a many-to-one link from the individual page into the state page, and then constructing
a one-to-many link of those linked values into the panel page. This two-step method
may be achieved by first performing the many-to-one link into the state page, and then
performing a one-to-many link of the SALES1 and SALES1CT links into the panel
page.
Linking by date match merging
To this point, we have primarily considered simple examples involving a single
categorical link identifier series (states). You may, of course, construct more elaborate
IDs using more than one series. For example, if you have data on multinational firms
observed over time, both the firm and date identifiers may be used as the link ID series.
The latter example is of note since it points to the fact that dates may be used as valid
link identifiers. The use of dates as identifiers requires special discussion, as the
notion of a match may be extended to take account of the calendar.
We begin our discussion of merging using dates by noting that a date may be
employed as an identifier in two distinct ways:
• First, an ID series containing date values or alphanumeric representations of dates
may be treated like any other ID series. In this case, the value in one workfile page
must be identical to the value in the other page for a match to exist.
• Alternatively, when we are working with regular frequency data, we may take
advantage of our knowledge of the frequency and the calender to define a broader
notion of date matching. This broader form of matching, which we term date matching,
involves comparing dates by first rounding the date ID values down to the lowest
common regular frequency and then comparing the rounded values. Note that date
matching requires the presence of at least one regular frequency for the rounding
procedure to be well-defined.
In practical terms, date matching produces the outcomes that one would naturally
expect. With date matching, for example, the quarterly observation “2002Q1” matches
“2002” in a regular annual workfile, since we round the quarterly observation down to
the annual frequency, and then match the rounded values. Likewise, we would match
the date “March 3, 2001” to the year 2001 in an annual workfile, and to “2001Q1” in a
quarterly workfile. Similarly, the date “July 10, 2001” also matches 2001 in the annual
workfile, but matches “2001Q3” in the quarterly workfile.
Basic links with date matching
Consider the following simple example of linking using date matching. Suppose that
we have a workfile containing two pages. The first page is a regular frequency
quarterly page containing profit data (PROFIT) for 2002 and 2003:
while the second page contains irregular data on special advertising events
(ADVERT):
We would like to link the quarterly profit data to the irregular data in the advertising
page. The quarterly values in the source page are unique so that we have a one-to-
one or one-to-many match merge; accordingly, we may select any contraction method
that leaves the original PROFIT data unchanged (mean, unique, etc.).
We first employ date matching by using the “@DATE” and “@DATE” keywords as our
ID series. This specification instructs EViews to use the knowledge about the date
structures in the page to perform a sophisticated matching across pages. Using this
approach, we construct a PROFIT1 link containing the values:
In evaluating the values in PROFIT1, we simply repeat the value of PROFIT for a given
quarter for every matching observation in the advertising page. Since we are using
date matching, we employ matching across pages that uses calendar knowledge to
determine matches. For example, the observation for quarter “2002Q1” matches both
“Jan 7, 2002” and “Mar 10, 2002” in the advertising page so that the latter observations
are assigned the value of 120.
Conversely, using date matching to link the ADVERT series to the quarterly page, we
have a many-to-one match merge since, after rounding down to the lower frequency,
multiple observations in the advertising page have “@DATE” values that match the
unique “@DATE” values in the quarterly page. If we choose to employ the mean
contraction method in the link ADVERT1, we have:
Here, the values of ADVERT1 contain the mean values over the observed days in the
quarter. For example, the value for ADVERT1 in 2002Q1 is taken by averaging the
values of ADVERT for “Jan 7, 2002” and “Mar 10, 2002”. Note that the value for quarter
2002Q3 is NA since there are no observations with matching DATE values, i.e., there
are no observations in the advertising page that fall within the quarter.
It is worth noting that in both of these examples, had we employed exact matching
using by specifying our ID series as QUARTER and DATE, we would have observed
no matches since the date numbers for the quarterly data do not match any of the
irregular date numbers. As a result, all of the values in the resulting link would be
assigned the value NA.
Panel links with date matching
When using date matching to link dated panel data to a page with a different
frequency, you should pay particular attention to the behavior of the merge operation
since the results may differ from expectations.
An example will illustrate the issue. Consider the following simple panel featuring
quarterly revenue data from 2002Q1 to 2003Q4:
We will consider the results from linking the REVENUE data into an annual page using
date matching of the QUARTER and the YEAR identifiers. Using date match merging
(with the “@DATE” and “@DATE” keywords), and employing both the sum and
number of observations contractions, we observe the results in REVENUE1 (sum) and
REVENUE1A (obs):
The important thing to note here is that the sums for each year have been computed
over all eight matching observations in the panel page.
The key to understanding the result is to bear in mind that date matching only changes
the way that a match between observations in the two pages is defined; the remaining
match merge operation remains unchanged. The outcome is simply the result of
applying standard link behavior in which we first identify matches, compute a
contraction over all matching observations, and perform the one-to-one match merge.
An alternative approach to obtaining annual revenue values from the panel data would
be to first contract the panel data to a quarterly frequency by averaging across firms,
and then to convert the quarterly data to an annual frequency by summing over
quarters. This approach, which produces very different results from the first method,
may be undertaken in two steps: by first linking the quarterly panel data into a quarterly
page (using the mean contraction), and then frequency converting by linking the
quarterly data to the annual frequency (summing over quarters).
In cases where you are linking between two panel pages at different frequencies there
are yet more complication. See “Panel frequency conversion” for a description of the
issues involved in constructing these types of links.
Linking by date with frequency conversion
In the special case where we wish to link data between two regular frequency pages
using dates as the sole identifier, EViews allows you to define your links in two ways.
First, you may use the date match merging described in “Linking by date match
merging”, or you can define special links that employ frequency conversion.
Basic frequency conversion
Links specified by date will primarily be used to perform automatic frequency
conversion of simple regular frequency data. For example, you may choose to hold
your quarterly frequency data in one page, your monthly frequency data in a second
page, and to create links between pages which automatically perform the up or down
frequency conversion as necessary.
You can instruct EViews to use the source series default methods for converting
between frequencies, or you may use the link definition to specify the up and down
conversion methods. Furthermore, the live nature of links means that changes in the
source data will generate automatic updates of the frequency converted link values.
We divide our discussion of frequency conversion links into those that link data from
high to low frequency pages and those that link from low to high frequency pages.
High to low frequency conversion
Frequency conversion linking from a simple regular high frequency page to a regular
low frequency page is fundamentally the same as using a link with date matching to
perform basic many-to-one match merging. In both cases, we match dates, compute
a contraction of the source series, and then perform a one-to-one match merge.
Given the specialized nature of frequency conversion, links specified by date with
frequency conversion offer a subset of the ordinary link contraction methods. All of the
standard high to low frequency conversion methods (average, sum, first, last,
maximum and minimum) are supported, but the match merge methods which do not
preserve levels, (such as the sum-of-squares or the variance) are not included.
Frequency conversion links also allow you to disable conversions for partially
observed periods, so that a missing value for the source series in a given month
generates a missing value for the corresponding quarterly observation. This option is
not available for basic match merge links.
Low to high- frequency conversion
In contrast, linking from low to high frequency pages using frequency conversion
differs substantively from linking using basic date match merging.
When linking using general date match merging, the frequency conversion implied by
the one-to-many match merge may only be performed by repeating the low frequency
observation for every matching high frequency observation. Thus, in a one-to-many
date match merge, an annual observation is always repeated for each matching
quarter, month, or day.
In contrast, EViews provides additional up-conversion methods for frequency
conversion links. In addition to the simple repeated-observation (constant-match
average) method, frequency conversion links support all of the standard frequency
conversion methods including constant-match sum, quadratic-match sum, quadratic-
match average, linear-match sum, linear-match last, and cubic-match last.
Suppose that, in addition to our regular frequency quarterly PROFIT workfile page, we
have a regular frequency monthly page containing observations spanning the period
from August 2002 to March 2003. Linking the PROFIT data from the quarterly page
into the monthly page by date, with frequency conversion, requires that we specify an
up-conversion method. Here, we show results of a frequency conversion link using
both the simple constant-match average (PROFIT2) and quadratic-match average
(PROFIT3) methods:
Note that the PROFIT2 values are the same as those obtained by linking using simple
date match merging, since the constant-match average method simply repeats the
PROFIT observations for each matching month. Conversely, the PROFIT3 values are
obtained using an interpolation method that is only available for linking by date with
frequency conversion.
Panel frequency conversion
There are additional issues to consider when performing frequency conversion links
in panel workfile settings:
• When working with two regular frequency panel pages, each defined by a single ID,
frequency conversion links construct values by performing the frequency conversion
separately for each value of the panel ID.
• If the source page is a regular frequency panel and the destination is an ordinary
regular frequency page, we contract the source series by computing means across
the panel identifiers to form a single time series (note that “mean” is the only
contraction allowed). The resulting time series, which is in the source frequency, is
then frequency converted to the destination frequency. Finally, the resulting series is
date match merged to the destination page.
Note that this is the behavior is the same as performing a general match merge using
“@DATE” as the identifiers, with a mean contraction.
• If the source page is an ordinary regular frequency page, and the destination is a
regular frequency panel, we frequency convert to the destination frequency, then date
match merge to the corresponding dates in each ID in the destination. Thus given
source value is repeated for all matching dates in the destination page (i.e., all IDs will
have the same time-series).
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 be performed using raw data copy unless you elect to employ
general match merging, as described in “Panel links with date matching”.
An example will illustrate the general approach. Suppose again that we are working
with the regular frequency, quarterly panel REVENUE data. For convenience, we
repeat the data here:
We now wish to use frequency conversion to link these data into an annual panel,
using the average frequency conversion method to go from high-to-low frequency.
Then the panel-to-panel frequency conversion will simply perform a frequency
conversion for each firm.
While these results may at first seem a bit odd, they simply follow the logic of the
discussion in “Panel links with date matching”. Note that our link which matches dates
between the two panel workfile pages is an example of a many-to-many match merge,
since there are multiple IDs with the same dates in each page. Thus, we will first
contract across IDs to obtain a unique time series in the original frequency, then
frequency convert, then one-to-many match in the destination page. In this case, the
initial contraction involves summing over firms to obtain a quarterly time series, then
frequency converting (summing) to the destination frequency to obtain annual values
for 2002 (670) and 2003 (730). The final step match merges these converted values
into the annual panel using a one-to-many match merge rule.
Creating a Link
Working with Links
IX. Advanced Workfiles
In “Workfile Basics,” we described the basics of workfiles; how to create and work with
a workfile, as well as the basics of using multi-page workfiles. In this chapter, we
describe advanced workfile types and tools for working with workfiles.
First, we describe the fundamentals of structured workfiles. You will need to
understand the concepts underlying structured workfiles to work with irregular dated
data, data involving cross-section identifiers, or panel structures.
Next, we outline various workfile level tools for managing your data. Among other
things, we discuss the basics of resizing a workfile, saving a workfile to foreign formats,
subsetting a workfile, and rearranging the format of the data in your workfile.
Structuring a Workfile
You may, at any time, change the underlying structure of an existing workfile or
workfile page by applying structuring information. We call this process structuring a
workfile. There are four primary types of structuring information that you may provide:
• regular date descriptions.
The ability to structure your data is an important feature, and we will explore structured
workfiles at some length.
Types of Structured Data
Before describing the process of structuring a workfile or workfile page, we define
some concepts related to the various data structures.
Regular and Irregular Frequency Data
As the name suggests, regular frequency data arrive at regular intervals (daily,
monthly, annually, etc.). Standard macroeconomic data such as quarterly GDP or
monthly housing starts are examples of regular frequency data. This type of data is
introduced in “Creating a Workfile by Describing its Structure”.
Unlike regular frequency data, Irregular frequency data do not arrive in a precisely
regular pattern. An important example of irregular data is found in stock and bond
prices, where the presence of missing days due to holidays and other market closures
means that the data do not follow a regular daily (7- or 5-day) frequency.
The most important characteristic of regular data is that there are no structural gaps
in the data—all observations in the specified frequency exist, even if there are missing
values that are not observed. Alternatively, irregular data allow for gaps between
successive observations in the given regular frequency. This is a subtle distinction,
but has important consequences for lag processing.
The distinction is best illustrated by an example. Suppose that we are working with a
daily calendar and that we have two kinds of data: data on bond prices (BOND), and
data on temperature in Los Angeles in Farenheit (TEMP):
Notice that in this example, the bond price is not available on 12/21 and 12/25 (since
the market was closed), and that the temperature reading was not available on 12/23
(due to equipment malfunction).
Typically, we would view the TEMP series as following a 7-day regular daily frequency
with a missing value for 12/23. The key feature of this interpretation is that the day
12/23 exists, even though a temperature reading was not taken on that day. Most
importantly, this interpretation implies that the lagged value of TEMP on 12/24 (the
previous day’s TEMP value) is NA.
In contrast, most analysts would view BOND prices as following an irregular daily
frequency in which days involving market closures do not exist. Under this
interpretation, we would remove weekends and holidays from the calendar so that the
bond data would be given by:
The central point here is that lags are defined differently for regular and irregular data.
Given a regular daily frequency, the lagged value of BOND on 12/26 would be taken
from the previous day, 12/25, and would be NA. Given the irregular daily frequency,
the lagged value on 12/26 is taken from the previous observation, 12/24, and would
be 102.78. In defining an irregular calendar, we explicitly skip over the structural gaps
created by market closure.
You may always convert irregular frequency data into regular frequency data by
adding any observations required to fill out the relevant calendar. If, for example, you
have 7-day irregular data, you may convert it to a regular frequency by adding
observations with IDs that correspond to any missing days.
Undated Data with Identifiers
Perhaps the simplest data structure involves undated data. We typically refer to these
data as cross-section data. Among the most common examples of cross-section data
are state data taken at a single point in time:
Here we have an alphabetically ordered dataset with 50 observations on state tax
rates. We emphasize the point that these data are undated since the common YEAR
of observation does not aid in identifying the individual observations.
These cross-section data may be treated as an unstructured dataset using the default
integer identifiers 1 to 50. Alternatively, we may structure the data using the unique
values in STATE as identifiers. These state name IDs will then be used when referring
to or labeling observations. The advantages of using the state names as identifiers
should be obvious—comparing data for observation labeled “Arizona” and “Wyoming”
is much easier than comparing data for observations “3” and “50”.
One last comment about the ordering of observations in cross-section data. While we
can (and will) define the lag observation to be that “preceding” a given observation,
such a definition is sensitive to the arbitrary ordering of our data, and may not be
meaningful. If, as in our example, we order our states alphabetically, the first lag of
“Arkansas” is taken from the “Arizona” observation, while if we order our observations
by population, the lag of “Arkansas” will be the data for “Utah”.
Panel Data
Some data involve observations that possess both cross-section (group) and within-
cross-section (cell) identifiers. We will term these to be panel data. Many of the
previously encountered data structures may be viewed as a trivial case of panel data
involving a single cross-section.
To extend our earlier example, suppose that instead of observing the cross-section
state tax data for a single year, we observe these rates for several years. We may
then treat an observation on any single tax rate as having two identifiers: a single
identifier for STATE (the group ID), and an identifier for the YEAR (the cell ID). The
data for two of our states, “Kansas” and “Kentucky” might look like the following:
We emphasize again that identifiers must uniquely determine the observation. A
corollary of this requirement is that the cell IDs uniquely identify observations within a
group. Note that requiring cell IDs to be unique within a group does not imply that the
cell IDs are unique. In fact, cell ID values are usually repeated across groups; for
example, a given YEAR value appears in many states since the tax rates are generally
observed in the same years.
If we observe repeated values in the cell identifiers within any one group, we must
either use a different cell identifier, or we must redefine our notion of a group. Suppose,
for example, that Kansas changed its tax rate several times during 2002:
In this setting, YEAR would not be a valid cell ID for groups defined by STATE, since
2002 would be repeated for STATE=“Kansas”.
There are a couple of things we may do. First, we may simply choose a different cell
identifier. We could, for example, create a variable containing a default integer
identifier running within each cross-section. For example, the newly created variable
CELL_ID1 is a valid cell ID since it provides each “Kansas” and “Kentucky”
observation with a unique (integer) value.
Alternately, we may elect to subdivide our groups. We may, for example, choose to
use both STATE and YEAR as the group identifier. This specification defines a group
for each unique STATE and YEAR combination (e.g. — observations for which
STATE=“Kansas” and YEAR=“2002” would comprise a single group). Given this new
group definition, we may use either CELL_ID1 or CELL_ID2 as cell identifiers since
they are both unique for each STATE and YEAR group. Notice that CELL_ID2 could
not have been used as a valid cell ID for STATE groups since it does not uniquely
identify observations within Kansas.
While it may at first appear to be innocuous, the choice between creating a new
variable or redefining your groups has important implications (especially for lag
processing). Roughly speaking, if you believe that observations within the original
groups are closely “related”, you should create a new cell ID; if you believe that the
subdivision creates groups that are more alike, then you should redefine your group
IDs.
In our example, if you believe that the observations for “Kansas” in “2001” and “2002”
are both fundamentally “Kansas” observations, then you should specify a new cell ID.
On the other hand, if you believe that observations for “Kansas” in “2002” are very
different from “Kansas” in “2001”, you should subdivide the original “Kansas” group by
using both STATE and YEAR as the group ID.
Lags, Leads, and Panel Structured Data
Following convention, the observations in our panel dataset are always stacked by
cross-section. We first collect the observations by cross-section and sort the cell IDs
within each cross-section. We then stack the cross sections on top of one another,
with the data for the first cross-section followed by the data for the second cross-
section, the second followed by the third, and so on.
The primary impact of this data arrangement is its effect on lag processing. There are
two fundamental principles of lag processing in panel data structures:
• First, lags and leads do not cross group boundaries, so that they never use data
from a different group.
• Second, lags and leads taken within a cross-section are defined over the sorted
values of the cell ID. This implies that lags of an observation are always associated
with lower value of the cell ID, and leads always involve a higher value (the first lag
observation has the next lowest value and the first lead has the next highest value).
Let us return to our original example with STATE as the group ID and YEAR as the
cell ID, and consider the values of TAXRATE, TAXRATE(-1), and TAXRATE(1).
Applying the two rules for panel lag processing, we have:
Note in particular, that the lags and leads of TAXRATE do not cross the group
boundaries; the value of TAXRATE(-1) for Kentucky in 2001 is an NA since the
previous value is from Kansas, and the value TAXRATE(1) for Kansas in 2003 is NA
is the next value is from Kentucky.
Next, consider an example where we have invalid IDs since there are duplicate YEAR
values for Kansas. Recall that there are two possible solutions to this problem: (1)
creating a new cell ID, or (2) redefining our groups. Here, we see why the choice
between using a new cell ID or subdividing groups has important implications for lag
processing. First, we may simply create a new cell ID that enumerates the
observations in each state (CELL_ID1). If we use CELL_ID1 as the cell identifier, we
have:
Note that the only observations for TAXRATE(-1) that are missing are those at the
“seams” joining the cross-sections.
Suppose instead that we elect to subdivide our STATE groupings by using both
STATE and YEAR to identify a cross-section, and we create CELL_ID2 which
enumerates the observations in each cross-section. Thus, each group is
representative of a unique STATE-YEAR pair, and the cell ID indexes observations in
a given STATE for a specific YEAR. The TAXRATE(-1) values are given in:
Once again, the missing observations for TAXRATE(-1) are those that span cross-
section boundaries. Note however, that since the group boundaries are now defined
by STATE and YEAR, there are more seams and TAXRATE(-1) has additional missing
values.
In this simple example, we see the difference between the alternate approaches for
handling duplicate IDs. Subdividing our groups creates additional groups, and
additional seams between those groups over which lags and leads are not processed.
Accordingly, if you wish your lags and leads to span all of the observations in the
original groupings, you should create a new cell ID to be used with the original group
identifier.
Types of Panel Data
Panel data may be characterized in a variety of ways. For purposes of creating panel
workfiles in EViews, there are several concepts that are of particular interest.
Dated vs. Undated Panels
We characterize panel data as dated or undated on the basis of the cell ID. When the
cell ID follows a frequency, we have a dated panel of the given frequency. If, for
example, our cell IDs are defined by a variable like YEAR, we say we have an annual
panel. Similarly, if the cell IDs are quarterly or daily identifiers, we say we have a
quarterly or daily panel.
Alternatively, an undated panel uses group specific default integers as cell IDs; by
default the cell IDs in each group are usually given by the default integers (1, 2, ...).
Regular vs. Irregular Dated Panels
Dated panels follow a regular or an irregular frequency. A panel is said to be a regular
frequency panel if the cell IDs for every group follow a regular frequency. If one or
more groups have cell ID values which do not follow a regular frequency, the panel is
said to be an irregular frequency panel.
One can convert an irregular frequency panel into a regular frequency panel by adding
observations to remove gaps in the calendar for all cross-sections. Note that this
procedure is a form of internal balancing (see “Balanced vs. Unbalanced Panels”
below) which uses the calendar to determine which observations to add instead of
using the set of cell IDs found in the data.
See “Regular and Irregular Frequency Data” for a general discussion of these topics.
Balanced vs. Unbalanced Panels
If every group in a panel has an identical set of cell ID values, we say that the panel
is fully balanced. All other panel datasets are said to be unbalanced.
In the simplest form of balanced panel data, every cross-section follows the same
regular frequency, with the same start and end dates—for example, data with 10
cross-sections, each with annual data from 1960 to 2002. Slightly more complex is the
case where every cross-section has an identical set of irregular cell IDs. In this case,
we say that the panel is balanced, but irregular.
We may balance a panel by adding observations to the unbalanced data. The
procedure is quite simple—for each cross-section or group, we add observations
corresponding to cell IDs that are not in the current group, but appear elsewhere in
the data. By adding observations with these “missing” cell IDs, we ensure that all of
the cross-sections have the same set of cell IDs.
To complicate matters, we may partially balance a panel. There are three possible
methods—we may choose to balance between the starts and ends, to balance the
starts, or to balance the ends. In each of these methods, we perform the procedure
for balancing data described above, but with the set of relevant cell IDs obtained from
a subset of the data. Performing all three forms of partial balancing is the same as
fully balancing the panel.
Balancing data between the starts and ends involves adding observations with cell
IDs that are not in the given group, but are both observed elsewhere in the data and
lie between the start and end cell ID of the given group. If, for example, the earliest
cell ID for a given group is “1985m01” and the latest ID is “1990m01”, the set of cell
IDs to consider adding is taken from the list of observed cell IDs that lie between these
two dates. The effect of balancing data between starts and ends is to create a panel
that is internally balanced, that is, balanced for observations with cell IDs ranging from
the latest start cell ID to the earliest end cell ID.
A simple example will better illustrate this concept. Suppose we begin with a two-
group panel dataset with the following data for the group ID (INDIV), and the cell ID
(YEAR):
You are given the choice of a Frequency, as well as a Start date and End date. The
only difference between this dialog and the workfile create version is that the End date
field is pre-filled with “@LAST”. This default reflects the fact that given a start date and
the number of observations in the existing workfile, EViews can calculate the end date
implied by “@LAST”. Alternatively, if we provide an ending date, and enter “@FIRST”
in the Start date field, EViews will automatically calculate the date associated with
“@FIRST”.
If we fill out the desired fields and click on OK, EViews will restructure the workfile. In
this example, we have specified a monthly frequency starting in 1960m01 and
continuing until “@LAST”. There are exactly 500 observations in the workfile since the
end date was calculated to match the existing workfile size.
Alternatively, we might elect to enter explicit values for both the starting and ending
dates. In this case, EViews will calculate the number of observations implied by these
dates and the specified frequency. If the number does not match the number of
observations in the existing workfile, you will be informed of this fact, and prompted to
continue. If you choose to proceed, EViews will both restructure and resize the workfile
to match your specification.
One consequence of this behavior is that resizing a workfile is a particular form of
restructuring. To resize a workfile, simply call up the Workfile structure dialog, and
change the beginning or ending date.
Here we have changed the End date from “2011m08” to “2011m12”, thereby
instructing EViews to add 4 observations to the end of the workfile. If you select OK,
EViews will inform you that it will add 4 observations and prompt you to continue. If
you proceed, EViews will resize the workfile to your specification.
Specifying Start and End Times
The method used to specify the start and end dates or times should be discussed a
bit further. Time periods are generally specified by intervals, such that an hour is
represented by the specification 00:00 to 59:59. Thus, a full 24 hour day is defined
with a start time of 00:00:00 and an end time of 23:59:59. You will notice that for
intraday data, the defaults provided by EViews when you create a workfile reflect this.
Similarly, a seven day week can be defined from Monday at 00:00:00 through Sunday
at 23:59:59. One second after this ending time, 24:00:00, refers to the following
Monday at midnight and is the first second of the next period.
Not only does specifying an end time of 24:00:00 extend into the next day by one
second, it will extend by an amount relative to the frequency being defined for the
workfile. For instance, given an hourly workfile, an end time of 24:00:00 would add an
extra hour to each day, since extending even a second into the next period adds a full
interval.
In general, when specifying a range of time for observations, time can be looked at in
terms of intervals or in terms of single measurements. For example, the time period 9
a.m. to 12 p.m. can be considered to be three hourly intervals: 9 a.m. to 10 a.m., 10
a.m. to 11 a.m, and 11 a.m. to 12 p.m. Alternately, it could be considered as four on-
the-hour measurements: the first at 9 a.m., the second at 10 a.m., the third at 11 a.m.,
and the fourth at 12 p.m. While the interval model may be more frequently used for
continuous measurements over time, it is really up to you to decide which model fits
your data better.
In the first case, which defines three intervals from 9 a.m. to 12 p.m., you would specify
your workfile with a start time of 9 a.m. and an end time of 11 a.m. This may not seem
intuitive, but remember that specifying an end time of 12 p.m. would add an additional
hour, defining the interval from 12 p.m. to 1 p.m. In fact, you could specify any end
time from 11:00:00 to 11:59:59 for the third interval.
If we wish to look at our data in terms of four discrete hourly measurements, as in the
second case, we would specify our workfile with a start time of 9 a.m. and an end time
of 12 p.m. Our data points could then be measured at 9 a.m., 10 a.m., 11 a.m., and
12 p.m.
The distinction between thinking of time in terms of intervals or as discrete
measurements is subtle. Generally, simply remember that the starting time will be
defined as the first observation, and the following observations are defined by the
length of time between the starting time and each subsequent time period. Specifying
a start time of 9 a.m. and an end time of 9 a.m. will generate a workfile with one
observation per day. To determine the number of observations, subtract the start time
from the end time and add one for the first observation.
Dated - specified by date series
The second approach to structuring your workfile is to provide the name of a series
containing the dates (or series than may be interpreted as dates) to be used as
observation identifiers. Select Dated - specified by date series in the dropdown menu,
and fill out the remainder of the dialog.
The first thing you must do is enter the name of one or more Date series that describe
the unique date identifiers.
The series may contain EViews date values (a true date series), or the single or
multiple series may contain numeric or string representations of unique dates. In the
latter case, EViews will create a single date series containing the date values
associated with the numeric or string representations. This new series, which will be
given a name of the form DATEID##, will be used as the identifier series.
On the right side of the dialog, you will specify additional information about your
workfile structure. In the first dropdown menu, you will choose one of the standard
EViews workfile frequencies (annual, quarterly, monthly, etc.). As shown in the image,
there is an additional (default) option, Auto detect, where EViews attempts to detect
the frequency of your data from the values in the specified series. In most cases you
should use the default; if, however, you choose to override the auto-detection, EViews
will associate the date values in the series with observations in the specified
frequency.
You may elect to use the EViews defaults, “@FIRST” and “@LAST”, for the Start date
and the End date. In this case, the earliest and latest dates found in the identifier series
will be used to define the observations in the workfile. Alternatively, you may specify
the start and end dates explicitly. If these dates involve resizing the workfile, you will
be informed of this fact, and prompted to continue.
The last option is the Insert empty obs checkbox. This option should be used if you
wish to ensure that you have a regular frequency workfile. If this option is selected,
EViews will add any observations necessary to remove gaps in the calendar at the
given frequency. If the option is not selected, EViews will use only the observed IDs
in the workfile and the workfile may be structured as an irregular workfile.
Suppose, for example, that you have observation with IDs for the quarters 1990Q1,
1990Q2, 1990Q4, but not 1990Q3. If Insert empty obs is checked, EViews will remove
the gap in the calendar by adding an observation corresponding to 1990:3. The
resulting workfile will be structured as a regular quarterly frequency workfile. If you do
not insert observations, the workfile will be treated as an irregular quarterly workfile.
Once you click on OK, EViews will first look for duplicate observation IDs. If duplicates
are not found, EViews will sort the data in your workfile by the values in the date series
and define the specified workfile structure. In addition, the date series is locked so that
it may not be altered, renamed, or deleted so long as it is being used to structure the
workfile.
Here, we show a group containing the original series B, the new series DATEID, and
the lag of B, B(-1). There are a few things to note. First, the observation identifiers are
no longer integers, but instead are values taken from the identifier series DATEID. The
formatting of the observation labels will use the display formatting present in the ID
series. If you wish to change the appearance of the labels, you should set the display
format for DATEID (see “Display Formats”).
Second, since we have sorted the contents of the workfile by the ID series, the values
in B and DATEID are ordered by date. Third, the lagged values of series use the
irregular calendar defined by DATEID—for example, the lag of the 1965 value is given
by 1961.
Alternately, we could have chosen to restructure with the Insert empty obs checkbox
selected, thus ensuring that we have a regular frequency workfile.
To see the effect of this option, we may reopen the Workfile structure dialog by double
clicking on the “Range:” string near the top of the workfile window, selecting the Insert
empty obs to remove gaps option, and then clicking on OK. EViews will inform us that
the restructure option involves creating 7 additional observations, and will prompt us
to continue. Click on OK again to proceed. The workfile will be converted to a regular
frequency annual workfile with observations from 1960 to 1976.
We again show the group containing B, DATEID, and B(-1). Notice that while the
observation identifiers and DATEID now include values for the previously missing
dates, B and B(-1), do not. When EViews adds observations in the restructure
operation, it sets all ordinary series values to NA or missing for those new
observations. You are responsible for filling in values as desired.
Dated Panels
To create a dated panel workfile, you should call up the Workfile structure dialog then
select Dated Panel as our structure type.
There are three parts to the specification of a dated panel. First, you must specify one
or more Date series that describe date identifiers that are unique within each group.
Next, you must specify the Cross-section ID series that identify members of a given
group. Lastly, you should set options which govern the choice of frequency of your
dated data, starting and ending dates, and the adding of observations for balancing
the panel or ensuring a regular frequency.
Dated Panel Basics
We begin by considering the Grunfeld data that have been described in a number of
places (see, for example, Baltagi (2005), Econometric Analysis of Panel Data, Third
Edition, from which this version of the data has been taken). The data measure R&D
expenditure and other economic measures for 10 firms for the years 1935 to 1954.
These 200 observations form a balanced panel dataset. We begin by reading the data
into an unstructured, 200 observation workfile.
To structure the panel for these data, we call up the Workfile structure dialog, select
Dated Panel as our structure type, and enter the name of the Cross-section ID series
representing firm number, FN, along with the Date series (cell ID) representing the
year, YR. If we leave the remaining settings at their default values, EViews will auto
detect the frequency of the panel, setting the start and end dates on the basis of the
values in the YR series, and will add any observations necessary so that the data
between the starts and ends is balanced.
When you click on OK to accept these settings, EViews creates a DATEID series,
sorts the data by ID and DATEID, locks the two series, and applies the structure. The
auto detecting of the date frequency and endpoints yields an annual (balanced) panel
beginning in 1935 and ending in 1954.
The basic information about this structure is displayed at the top of the workfile
window. There are a total of 200 observations representing a balanced panel of 10
cross-sections with data from 1935 to 1954.
Notice that the observation labels for the structured panel workfile show both the group
identifier and the cell identifier.
Dated Panel Balancing
In the basic Grunfeld example, the data originally formed a balanced panel so the
various balance operations have no effect on the resulting workfile. Similarly, the
option to insert observations to remove gaps has no effect since the data already
follow a regular (annual) frequency with no gaps.
Let us now consider a slightly more complicated example involving panel data that are
both unbalanced and irregular. For simplicity, we have created an unbalanced dataset
by taking a 150 observation subset of the 200 observations in the Grunfeld dataset.
First, we call up the Workfile structure dialog and again select Dated Panel. We begin
by using FN and YR as our group and cell IDs, respectively. Use Auto detect to
determine the frequency, do not perform any balancing, and click on OK. With these
settings, our workfile will be structured as an unbalanced, irregular, annual workfile
ranging from 1935 to 1954.
Alternatively, we can elect to perform one or more forms of balancing either at the time
the panel structure is put into place, or in a restructure step. Simply call up the Workfile
structure dialog and select the desired forms of balancing. If you have previously
structured your workfile, the dialog will be pre-filled with the existing identifiers and
frequency. In this example, we will have our existing annual panel structure with
identifiers DATEID and FN.
In addition to choosing whether to Balance starts and Balance ends, you may choose,
at most, one of the two options Balance between starts and ends, and Insert obs to
remove date gaps so date follows regular frequency.
If balancing between starts and ends, the balancing procedure will use the observed
cell IDs (in this case, the years encoded in DATEID for all cross-sections) between a
given start and end date. All cross-sections will share the same possibly irregular
calendar for observations between their starts and ends. If you also elect to insert
observations to remove date gaps, EViews balances each cross-section between
starts and ends using every date in the calendar for the given frequency. In the latter
case, all cross-sections share the same regular calendar for observations between
their starts and ends.
Selecting all three options, Balance starts, Balance ends and Balance between starts
and ends, ensures a balanced panel workfile. If we substitute the option Insert obs to
remove date gaps so date follows regular frequency for Balance between starts and
ends, we further guarantee that the data follow a regular frequency.
In partly or fully balancing the panel workfile, EViews will add observations as
necessary, and update the corresponding data in the identifier series. All other
variables will have their values for these observations set to NA. Here, we see that
EViews has added data for the two identifier series FN and DATEID while the ordinary
series YR values associated with the added observations are missing.
Undated with ID series
If you wish to provide cross-section identifiers for your undated data, select Undated
with identifier series in the dropdown menu.
EViews will prompt you to enter the names of one or more ID series. When you click
on OK, EViews will first sort the workfile by the values of the ID series, and then lock
the series so that it may not be altered so long as the structure is in place. The values
of the ID series will now be used in place of the default integer identifiers.
When we click on OK, EViews analyzes the data in TOWNID and determines that
there are duplicate observations—there are, for example, 22 observations with a
TOWNID of 5. Since TOWNID does not uniquely identify the individual observations,
EViews prompts you to create a new cell ID series.
If you click on No, EViews will return you to the specification page where you may
define a different set of group identifiers. If you choose to continue, EViews will create
a new series with a name of the form CELLID## (e.g., CELLID, CELLID01, CELLID02,
etc.) containing the default integer cell identifiers. This series will automatically be
used in defining the workfile structure.
There are important differences between the two approaches (i.e., creating a new ID
series, or providing a second ID series in the dialog) that are discussed in “Lags,
Leads, and Panel Structured Data”. In most circumstances, however, you will click on
Yes to continue. At this point, EViews will inform you that you have chosen to define
a two-dimensional, undated panel, and will prompt you to continue. In this example,
the data are unbalanced, which is also noted in the prompt.
When you click on Yes to continue, EViews will restructure the workfile using the
identifiers TOWNID and CELLID##. The data will be sorted by the two identifiers, and
the two-dimensional panel structure applied. The workfile window will change to show
this restructuring. As depicted in the upper portion, we have a 506 observation,
undated panel with dimension (92, 30)—92 groups with a maximum of 30 observations
in any group.
Note that in this example, balancing the starts or interiors has no effect on the workfile
since CELLID## has cell IDs that begin at 1 and run consecutively for every group. If,
however, we choose to balance the ends, which vary between 1 and 30, the
corresponding resize operation would add 2254 observations. The final result would
be a workfile with 2760 observations, comprised of 92 groups, each with 30
observations.
Common Structuring Errors
In most settings, you should find that the process of structuring your workfile is
relatively straightforward. It is possible, however, to provide EViews with identifier
information that contains errors so that it is inconsistent with the desired workfile
structure. In these cases, EViews will either error, or issue a warning and offer a
possible solution. Some common errors warrant additional discussion.
Non-unique identifiers
The most important characteristic of observation identifiers is that they uniquely
identify every observation. If you attempt to structure a workfile with identifiers that are
not unique, EViews will warn you of this fact, will offer to create a new cell ID, and will
prompt you to proceed. If you choose to proceed, EViews will then prompt you to
create a panel workfile structure using both the originally specified ID(s) and the new
cell ID to identify the observations. We have seen an example of this behavior in our
discussion of the undated panel workfile type (“Undated Panels”).
In some cases, however, this behavior is not desired. If EViews reports that your date
IDs are not unique, you might choose to go back and either modify or correct the
original ID values, or specify an alternate frequency in which the identifiers are unique.
For example, the date string identifier values “1/1/2002” and “2/1/2002” are not unique
in a quarterly workfile, but are unique in a monthly workfile.
Invalid date identifiers
When defining dated workfile structures, EViews requires that you enter the name or
names of series containing date information. This date information may be in the form
of valid EViews date values, or it may be provided in numbers or strings which EViews
will attempt to interpret as valid date values. In the latter case, EViews will attempt to
create a new series containing the interpreted date values.
If EViews is unable to translate your date information into date values, it will issue an
error indicating that the date series has invalid values or that it is unable to interpret
your date specification. You must either edit your date series, or structure your workfile
as an undated workfile with an ID series.
In cases where your date information is valid, but contains values that correspond to
unlikely dates, EViews will inform you of this fact and prompt you to continue.
Suppose, for example, that you have a series that contains 4-digit year identifiers
(“1981,” “1982,” etc.), but also has one value that is coded as a 2-digit year (“80”). If
you attempt to use this series as your date series, EViews will warn you that it appears
to be an integer series and will ask you if you wish to recode the data as integer dates.
If your proceed, EViews will alter the values in your series and create an integer dated
(i.e., not time dated) workfile, which may not be what you anticipated.
Alternately, you may cancel the restructure procedure, edit your date info series so
that it contains valid values, and reattempt to apply a structure.
Missing value identifiers
Your identifier series may be numeric or alpha series containing missing values. How
EViews handles these missing values depends on whether the series is used as a
date ID series, or as an observation or group ID series.
Missing values are not allowed in situations where EViews expects date information.
If EViews encounters missing values in a date ID series, it will issue a warning and will
prompt you to delete the corresponding observations. If you proceed, EViews will
remove the observations from the workfile. If removed, the observations may not be
recovered, even if you subsequently change or remove the workfile structure.
If the missing values are observed in an observation or group ID series, EViews will
offer you a choice of whether to keep or remove the corresponding observations, or
whether to cancel the restructure. If you choose to keep the observations, the missing
value, NA, for numeric series, and a blank string for alpha series, will be used as an
observation or cross-section ID in the restructured workfile. If you choose to drop the
observations, EViews will simply remove them from the workfile. These observations
may not be recovered.
Removing a Workfile Structure
You may remove a workfile structure at any time by restructuring to an unstructured
or regular frequency dated workfile. Call up the Workfile structure dialog and select
Unstructured/Undated or Dated - regular frequency from the dropdown menu. Fill out
the appropriate entries and click OK.
EViews will remove the workfile structure and will unlock any series used as date,
group, or observation identifiers.
Popup
Resizing a Workfile
Resizing a workfile page is a special case of restructuring. Simply call up the Workfile
structure dialog for any workfile page by selecting Proc/“Structure/Resize Current
Page...” from a workfile window, or by clicking on the “Range:” description header near
the top of the main workfile window. EViews will open the workfile structure dialog with
your current settings displayed in the appropriate fields.
Dated - regular frequency / Unstructured
For workfile types where the structure of the data is described explicitly (dated with
regular frequency, or unstructured), the Start date and End date, or Observations
values will be filled out with actual values.
To change the sizes of regular frequency workfiles, enter the appropriate Start date
and End date information using explicit dates or offsets from “@FIRST” and “@LAST”.
To change the size of an unstructured workfile, change the number of Observations.
Note that for unstructured data, you may only add or delete observations from the end
of the workfile, you may not change the starting observation; if you wish to modify the
starting observation you will need to work with an integer dated workfile.
EViews will inform you of the number of observations to be added and/or deleted, and
will prompt you to continue.
For example, changing the End date for your annual workfile from “2001” to “2009”, or
the number of Observations in your unstructured workfile from “100” to “107” will both
add 7 observations to the end of the respective workfiles. Likewise, changing the Start
date of your monthly workfile from “1990:01” to “@FIRST-24” will add 24 months to
the beginning of the workfile while changing the End date to “@LAST-3” removes
(deletes) the last three observations.
Dated - specified by date series
For a dated workfile that is structured using a date series, the dialog will open with
pre-filled Start date and End date values containing “@FIRST” and “@LAST” as stand-
ins for the earliest and latest observed dates. To change the size of a dated workfile
structured by a date series, simply enter the appropriate information using explicit
dates or offsets from “@FIRST” and “@LAST”.
Given your start and end date values, EViews will analyze your date identifiers to
determine whether you need to add or remove observations. If required, EViews will
inform you of the number of observations to be added or deleted, and you will be
prompted to continue. If observations are added, the date series will be modified to
hold the corresponding date values. As with other forms of restructuring, deleted
observations may not be recovered.
An observation will be deleted if the corresponding date ID falls outside the range
implied by the start and end dates. If we enter “1970” as the Start date and “2010” as
the End date in our annual workfile, any observations whose date series value is
earlier than 1970 or later than 2010 will be removed from the workfile. If we enter
“@FIRST+2” and “@LAST-3” as our Start date and End date, EViews will delete the
first two and last three observations from the workfile.
EViews will add observations to the workfile if the Start date is earlier than “@FIRST”
or the End date is later than “@LAST”. The observations to be added are determined
by examining the regular frequency calendar to find all possible dates which fall in the
desired range. If, in our annual workfile that ranges from 1980 to 2000, we specify a
Start date of “1975”, EViews will add observations for all of the years from 1975 to
1979, and will modify the date series so that it contains the associated date values.
Alternatively, entering “@FIRST–2” and “@LAST+2” adds two observations
corresponding to 1978 and 1979, and two observations corresponding to 2001 and
2002.
Note that there is a bit of asymmetry here in the use of offsets to “@FIRST” and
“@LAST”. Offsets that remove observations from the workfile simply count from the
first or last observation, while offsets that add observations to the workfile use the
regular frequency calendar to determine the dates to be added.
Dated Panel
For dated panel workfiles, the prefilled Start date and End date values will contain
“@FIRST” and “@LAST” as stand-ins for the cross-section specific earliest and latest
observed dates. To resize a dated panel workfile, you may enter an explicit date value
in one or both of those fields. If you elect to use offsets, you must take care to
understand the inherent complexities involved.
When you enter “@FIRST+2” and “@LAST–2”, EViews trims off 2 observations from
the beginning and end of each cross-section. Used in this fashion, “@FIRST” refers
to the earliest date for each cross-section, and the offsets are in observation space.
If we combine this trimming with balancing starts or ends, balancing occurs prior to
the trimming of observations. Interestingly, this means that the starts or ends will not
necessarily be balanced following trimming.
In order to use “@FIRST–2” or “@LAST+2”, EViews must balance starts or ends. The
interpretation of the offsets that extend beyond the range of observations differs since
they are evaluated in regular date space. If you enter “@FIRST–2” and choose to
balance starts, the behavior is: first balance starts, then add two observations to the
beginning in date space. Note that this operation is the same as adding two
observations in regular date space to the cross-section with the earliest observed date
and then balancing starts.
This behavior means that you cannot easily add two observations (in date space) to
the start or end of each cross-section, without possibly adding more via start or end
balancing. The panel data will have balanced starts or ends following the operation.
Undated with ID series / Undated Panel
Resizing an undated workfile that is structured using an ID series requires several
distinct operations, since there is no simple way to describe the restructure operation.
At a deep level, resizing these types of workfiles involves modifying your identifiers,
and then adding or deleting observations with specific identifier values.
To alter the identifier series you must first remove the workfile structure. Call up the
Workfile structure dialog and select Unstructured/Undated from the dropdown menu.
Click on OK. EViews will remove the existing workfile structure and will unlock the ID
series.
If you wish to remove observations, you should edit one of the ID series so that the
desired observations have missing IDs. If you reapply the original Undated with ID
series or Undated Panel structure, EViews will prompt you to remove observations
with the missing ID values. We remind you that this step will remove all observations
with missing values for the identifiers; if you originally used the missing value as a
valid identifier, the corresponding observation will also be removed.
To add observations, you must first append observations to the workfile by expanding
the unstructured workfile and then editing the ID series to add unique identifiers for
the new values, or by using the built-in tools to append to the workfile page described
below. Once you have added the new observations, you may reapply the workfile
structure. EViews will sort your data using the identifier values, lock down the ID
series, and then apply the structure to the expanded workfile.
Popup
Appending to a Workfile
One method of combining two workfile pages is to append observations from a source
workfile page to the end of a target workfile page. When appending data, EViews first
removes any structure from the target page, then expands its range to encompass the
combined range of the original page and the appended data. The data from the source
page are then copied to the expanded part of the target workfile range, either in
existing series or alpha objects, or in newly created objects.
When appending, you should first make certain that the workfiles containing both the
source and target page are open in EViews. In some cases (for example,
concatenating a workfile page with itself), you only need to have a single open workfile
since the source and target workfiles are the same.
To open the Workfile Append dialog, click on the Proc button on the target workfile
toolbar and select Append to Current Page..., or select Proc/Append to Current Page...
from the main menu.
• an object with the same name exists in the target, but the object type is not
compatible.
• an object with the same name exists in the target, and the object type is compatible
with the source object.
In saying that the source and destination objects are compatible, we indicate that the
source data may be added to the end of the existing object. Series and numeric link
data may only be added to the end of series objects, while alpha and alpha link data
may only be added to the end of alpha objects. All other combinations of objects are
said to be incompatible.
Suppose that we wish to append the source series X or numeric link to the target page.
If there is no object with the same name in the target page, EViews will create a new
series, X, containing NA values for the original target page observations, and the
values of the source series X for observations in the expanded part of the range.
If there is an incompatible matching object, a new object will be created with a name
formed from the original name and the text specified in the Suffix to apply to renamed
objects edit field. If, for example, the target page contains an incompatible X (e.g., it
contains the equation X), EViews will create a new series using the original name, and
the specified suffix, for example, “X_A” (using the default suffix, “_A”).
If there is a compatible matching object, EViews will examine your dialog settings to
determine the appropriate behavior. By default, EViews will append the data from a
compatible source object to the end of the existing object. Thus, data from the series
or numeric link X will be copied to the expanded part of the range of the target series
X, and data from the alpha or alpha link Y will be copied to the end of the alpha series
Y. You may override this default so that EViews creates a new object even when the
matching objects are compatible, by unselecting the Merge series or Merge alpha
checkboxes.
Creating Identifier Series
The optional Created series settings in the dialog allow you to save series containing
information about each observation in the combined workfile.
To save a series containing the date or observation ID associated with each
observation in the combined workfile, you should enter a unique name in the edit field
labeled Date/Obs ID. The specified series will be created in the target page, and will
contain the observation or cell identifiers given by the structures associated with the
source and the original target pages. Saving the IDs is particularly useful since
appending to a workfile removes the existing page structure.
The optional Workfile ID series identifies the source of the observation in the combined
workfile: observations in the original target page are assigned the value 0, while
observations in the appended portion of the target will be given the value 1.
Popup
Contracting a Workfile
Samples are an important tool for restricting the set of observations used by EViews
when performing calculations. You may, for example, set an estimation sample to
restrict the observations used in a regression to only include females, or to only use
the observations with dates between 1990 and 2003. An important advantage to
working with samples is that the exclusion of observations is temporary, and may be
reset simply by providing a new sample specification. Note also that even as they are
excluded from calculations, out-of-sample observations still exist, and are used for lag
processing.
There may be times, however, when you wish to drop or remove observations from a
workfile page. For example, if you have daily data on stock trades and want lags to
skip holidays, you must permanently remove holidays from the workfile. Similarly, if
the focus of your analysis is on female labor force participation, you may wish to subset
your workfile by excluding all males. Contracting the workfile in this fashion both
reduces the size of the workfile and makes it easier to work with, since you no longer
have to remember to set all samples to exclude males.
To contract a workfile page in place, you should click on the Proc button on the workfile
toolbar and select Contract Current Page..., or select Proc/Contract Current Page...
from the main menu.
EViews will open the Workfile Contract dialog prompting you to input a valid sample
specification. Simply enter a sample specification and EViews will drop all
observations in the current page that do not meet the specified criteria. Here, we drop
all observations where the ID series is greater than 7 or where K lies between 100 and
200 (inclusive).
We emphasize that the workfile contraction occurs in place so that the existing workfile
page will no longer exist. If you wish to keep the original page, you should make a
copy of the page, or save it to disk.
Popup
The copy by link procedure will create the links in a new page in the existing workfile.
By default, the page will be given a name based on the page structure (e.g., “Annual”,
or “Daily5”). You may provide a name for this destination page by clicking on the Page
Destination tab and enter the desired name. If a page with that name already exists in
the workfile, EViews will create a new page using the next available name. Note that
since we are copying by link, you may not create a page in a different workfile.
When you click on OK to accept the dialog settings, EViews first examines your source
workfile and the specified sample, and then creates a new page with the appropriate
number of observations.
Next, EViews will copy, by value, the ID series used to structure the source workfile
page for the specified sample of observations. Using the new series, EViews will
structure the new workfile in a manner similar to the source workfile page. If, for
example, you have an undated workfile that is structured using an ID series
COUNTRIES, EViews will create a series in the destination page, copy the relevant
values, and structure the page as an undated workfile using the new ID series
COUNTRIES. Similarly, if the original page has an annual panel structure that is
defined using multiple ID series, all of the ID series will be copied to the new page,
and the page will be structured as an annual panel using these new series.
Lastly, EViews will create links in the new page for all of the specified series objects.
The links will be defined as general match merge links using the source and
destination ID series. Since the new page is a subset of the original page, the
contraction methods will be set to No contractions allowed (see “Link calculation
settings”).
Copying by Value
To copy all or part of the workfile by value, you should select Proc/“Copy/Extract from
Current Page”/By Value to New Page or Workfile.... EViews will open the Workfile
Copy By Value dialog.
You should first specify an EViews sample describing the observations to be copied.
By default, EViews will use the sample “@ALL”.
Next, you should use the dropdown menu to select a Random subsample method. By
default, all of the observations in the sample will be used (No random subsampling),
but you may choose to extract a random sample in one of three ways:
• You may extract a subsample with a fixed number of observations (Fixed subsample
size - number of observations). If the specified subsample size is larger than the
number of observations, the entire sample is used.
• You may select a subsample with a fixed size, where the number of observations is
specified as a percent of the total number of observations (Fixed subsample size - %
of observations).
• You may take a simple random sample in which every observation has a fixed
probability of being selected (Random subsample size - % applied to each obs). As
the label suggests, the number of observations in the resulting subsample is itself
random.
In the remainder of the dialog page you should specify the objects to be copied. There
are two parts to the object specification: a list of object names, and a set of modifiers
for object types.
By default, the All objects radio button is selected so that the list of object names
provided to EViews will include every object in the source workfile. You may instead
provide an explicit list by clicking on the Listed objects radio button and entering the
names of objects (using wildcards if appropriate).
The type matching checkboxes (Series - Alphas - Valmaps, Links, Estimation & Model
Objects, All others) may be used to restrict the object list on the basis of broad
classifications for type; an object will be copied only if it is in the list of object names
provided in the edit box, and if its type matches a classification that you elect to copy.
If, for example, you wish to remove all objects that are not series objects or valmaps
from your list, you should uncheck the Estimation & Model objects and the All others
checkboxes.
Lastly, you may optionally provide a destination workfile page. By default, EViews will
copy the data to a new workfile in a page named after the workfile page structure (e.g.,
“Quarterly,” “Monthly”). You may provide an alternative destination by clicking on the
Page Destination tab in the dialog, and entering the desired destination workfile and/or
page.
When you click on OK, EViews examines your source workfile and the specified
sample, and creates a new page with the appropriate number of observations. EViews
then copies the ID series used to structure the source workfile, and structures the new
workfile in identical fashion. Lastly, the specified objects are copied to the new workfile
page.
Popup
Reshaping a Workfile
In a typical study, each subject (individual, firm, period, etc.) is observed only once. In
these cases, each observation corresponds to a different subject, and each series,
alpha, or link in the workfile represents a distinct variable.
In contrast, repeated measures data may arise when the same subject is observed at
different times or under different settings. The term repeated measures comes from
the fact that for a given subject we may have repeated values, or measures, for some
variables. For example, in longitudinal surveys, subjects may be asked about their
economic status on an annual basis over a period of several years. Similarly, in clinical
drug trials, individual patient health may be observed after several treatment events.
It is worth noting that standard time series data may be viewed as a special case of
repeated measures data, in which there are repeated higher frequency observations
for each lower frequency observation. Quarterly data may, for example, be viewed as
data in which there are four repeated values for each annual observation. While time
series data are not typically viewed in this context, the interpretation suggests that the
reshaping tools described in this section are generally applicable to time series data.
There are two basic ways that repeated measures data may be organized in an
EViews workfile. To illustrate the different formats, we consider a couple of simple
examples.
Suppose that we have the following dataset:
The series ID2 no longer exists as a distinct series in the new format, but instead
appears implicitly in the names associated with the new series (SALESJASON and
SALESADAM). The repeated values for SALES are no longer represented by multiple
observations, but are instead represented in the multiple series values associated with
each value of ID1.
Note also that this representation of the data requires that we add an additional
observation corresponding to the case ID1=3, ID2=“Adam”. Since the observation did
not exist in the original representation, the corresponding value of SALESADAM is set
to NA.
Alternatively, we may rearrange the data using the values in ID1 to break SALES into
multiple series:
where we have added the columns labeled YEAR and QUARTER so that you may
more readily see the repeated measures interpretation of the data.
We may rearrange the time series data so that it is unstacked by QUARTER,
Year Z1 Z2 Z3 Z4
2000 2.1 3.2 5.7 6.3
2001 7.4 8.1 8.8 9.2
EViews provides you with convenient tools for reshaping workfiles between these
different formats. These tools make it easy to prepare a workfile page that is set up
for use with built-in pool or panel data features, or to convert data held in one time
series representation into an alternative format.
Unstacking a Workfile
Unstacking a workfile involves taking series objects in a workfile page, and in a new
workfile, breaking the original series into multiple series.
We employ an unstacking ID series in the original workfile to determine the destination
series, and an observation ID series to determine the destination observation, for
every observation in the original workfile. Accordingly, we say that a workfile is
“unstacked by” the values of the unstacking ID series.
To ensure that each series observation in the new workfile contains no more than one
observation from the existing workfile, we require that the unstacking ID and the
observation ID are chosen such that no two observations in the original workfile have
the same set of values for the identifier series. In other words, the identifier series
must together uniquely identify observations in the original workfile.
While you may use any series in the workfile as your unstacking and observation
identifier series, an obvious choice for the identifiers will come from the set of series
used to structure the workfile (if available). In a dated panel, for example, the cross-
section ID and date ID series uniquely identify the rows of the workfile. We may then
choose either of these series as the unstacking ID, and the other as the observation
ID.
If we unstack the data by the cross-section ID, we end up with a simple dated workfile
with each existing series split into separate series, each corresponding to a distinct
cross-section ID value. This is the workfile structure used by the EViews pool object,
and is commonly used when the number of cross-sectional units is small. Accordingly,
one important application of unstacking a workfile involves taking a page with a panel
structure and creating a new page suitable for use with EViews pool objects.
On the other hand, if we unstack the panel workfile by date (using the date ID series
or @DATE), we end up with a workfile where each row represents a cross-sectional
unit, and each original series is split into separate series, one for each observed time
period. This format is frequently used in the traditional repeated measures setting
where a small number of variables in a cross-sectional dataset have been observed
at different times.
To this point, we have described the unstacking of panel data. Even if your workfile is
structured using a single identifier series, however, it may be possible to unstack the
workfile by first splitting the single identifier into two parts, and using the two parts as
the identifier series. For example, consider the simple quarterly data given by:
Date X Y
2000Q1 NA -2.3
2000Q2 5.6 -2.3
2000Q3 8.7 -2.3
2000Q4 9.6 -2.3
2001Q1 12.1 1.6
2001Q2 8.6 1.6
2001Q3 14.1 1.6
2001Q4 15.2 1.6
Suppose we wish to unstack the X series. We may split the date identifier into a year
component and a quarter component (using, say, the EViews @YEAR and
@QUARTER functions). If we extract the QUARTER and YEAR from the date and
use the QUARTER as the unstacking identifier, and the YEAR as the observation
identifier, we obtain the unstacked data:
Year X1 X2 X3 X4
2000 NA 5.6 8.7 9.6
2001 12.1 8.6 14.1 15.2
Note that we have chosen to form the series names by concatenating the name of the
X series, and the values of the QUARTER series.
Alternatively, if we use YEAR as the unstacking ID, and QUARTER as the observation
ID, we have:
In some cases, a series in the original workfile will not vary by the unstacking ID. In
our example, we have a series Y that is only updated once a year. Stacking by
QUARTER yields:
Year Y1 Y2 Y3 Y4
2000 -2.3 -2.3 -2.3 -2.3
2001 1.6 1.6 1.6 1.6
Since there is no change in the observations across quarters, these data may be
written as:
Year Y
2000 -2.3
2001 1.6
without loss of information. When unstacking, EViews will automatically avoid splitting
any series which does not vary across different values of the unstacking ID. Thus, if
you ask EViews to unstack the original Y by QUARTER, only the compacted (single
series) form will be saved. Note that unstacking by YEAR will not produce a compacted
format since Y is not constant across values of YEAR for a given value of QUARTER.
Unstacking a Workfile in EViews
To unstack the active workfile page, you should select Proc/Reshape Current
Page/Unstack in New Page... from the main workfile menu. EViews will respond by
opening the tabbed Workfile Unstack dialog.
When unstacking data, there are four key pieces of information that should be
provided: a series object that contains the unstacking IDs, a series object that contains
the observation IDs, the series in the source workfile that you wish to unstack, and a
rule for defining names for the unstacked series.
Unstacking Identifiers
To unstack data contained in a workfile page, your source page must contain a series
object containing the unstacking identifiers associated with each observation. For
example, you may have an alpha series containing country abbreviations (“US,” “JPN,”
“UK”), or individual names (“Joe Smith,” “Jane Doe”), or a numeric series with integer
identifiers (“1,” “2,” “3,” “50,” “100,” ...). Typically, there will be repeated observations
for each of the unique unstacking ID values.
You should provide the name of your unstacking ID series object in the top edit field
of the dialog. When unstacking, EViews will create a separate series for each distinct
value of the ID series, with each of these series containing the multiple observations
associated with that value. The series used as the unstacking ID is always dropped
from the destination workfile since its values are redundant since they are built into
the multiple series names.
If you wish to unstack using values in more than one series, you must create a new
series that combines the two identifiers by identifying the subgroups, or you may
simply repeat the unstacking operation.
Observation Identifiers
Next, you must specify a series object containing an observation ID series in the
second edit field. The values of this series are used to identify both the individual
observations in the unstacked series and the structure of the destination page.
Once again, if your workfile is structured, an obvious choice for the unstacking
identifier series comes from the series used to structure the workfile, either directly
(the date or cross-section ID in a panel page), or indirectly (the YEAR or QUARTER
extracted from a quarterly date).
EViews will, if necessary, create a new observation ID series in the unstacked page
with the same name as, and containing the unique values of, the original observation
ID series. This series will be used to structure the workfile.
If the original observation ID is an ordinary series or alpha, the new page will be
structured as a cross-section page using the new identifier series. Alternatively, if the
observation ID is a date series or the “@DATE” keyword, EViews will analyze the
observed date values and will create a dated page with the appropriate frequency.
Series to be Unstacked
You may enter the names of the series, alphas, and links that you wish to unstack in
the edit field Series to be unstacked into new workfile page. You may enter the names
directly, or use expressions containing wildcards. For example, the expression
“SALES A*” instructs EViews to unstack both the SALES series as well as all series
objects beginning with the letter “A”.
Note that the RESID series and the unstacking ID series may not be unstacked.
Naming Unstacked Series
EViews will use the pattern in the Name pattern for unstacked series field to construct
the names for the new unstacked series or alphas associated with each stacked series
object.
By default, the wildcard pattern “*?” will be used, meaning that unstacked series
names will be constructed by concatenating the name of the series object to be
unstacked and a string containing one of the unique values found in the unstacking ID
series.
In our example above, when unstacking the SALES series using NAME as the
unstacking ID series and the wildcard name pattern “*?”, EViews will create the series
JASONSALES and ADAMSALES. If instead, we enter the pattern “?_*”, EViews will
put the unstacked values in the series SALES_JASON and SALES_ADAM.
Unstacking Destination
By default, EViews will unstack the data in a new UNTITLED page in the existing
workfile. You may provide an alternative destination by clicking on the Page
Destination tab in the dialog, and entering the desired destination.
An Example
Consider a workfile that contains the series GDP and CONS, which contain the values
of Gross Domestic Product and consumption for three countries stacked on top of
each other.
Suppose further that there is an alpha object called COUNTRY containing the values
“US,” “UK,” and “JPN”, which identify the country associated with each observation on
GDP and CONS. Finally, suppose there is a date series DATEID which identifies the
date associated with each observation in the page. COUNTRY and DATEID uniquely
determine the observation identifiers.
In our example, we assume that the source page contains annual data from 1991 to
2000 for the three countries in our panel. We can better see this structure by opening
a group window showing the values of COUNTRY, DATEID (displayed in year-date
format), and GDP.
We wish to unstack the data in GDP and CONS using the unstacking ID values in
COUNTRY, and the observation IDs in DATEID. Click on Proc/Reshape Current
Page/Unstack in New Page... in the workfile window to bring up the unstacking dialog.
Enter “COUNTRY” as the unstacking ID series, and “DATEID” for the observation
identifier. We leave the remainder of the dialog settings at the default values, so that
EViews will use “*?” as the name pattern, will copy all series objects in the page (with
the exception of RESID and COUNTRY), and will place the results in a new page in
the same workfile.
If you click on OK to accept the settings, EViews will first examine the DATEID series
to determine the number of unique observation identifiers. Note that the number of
unique observation identifier values determines the number of observations in the
unstacked workfile. Next, EViews will determine the number of unique values in
COUNTRY, which is equal to the number of unstacked series created for each stacked
series.
In this example, we start with a balanced panel with 10 distinct values for DATEID,
and three distinct values in COUNTRY. The resulting UNTITLED workfile page will
follow an annual frequency from the 10 observations from 1991 to 2000, and will have
three unstacked series corresponding to each of the source series. The names of
these series will be formed by taking the original series name and appending the
distinct values in COUNTRY (“US,” “UK,” and “JPN”).
Note that in addition to the six unstacked series CONSJPN, CONSUK, CONSUS,
GDPJPN, GDPUK, GDPUS, EViews has created four additional objects. First, the
unstacked page contains two group objects taking the name of, and corresponding to,
the original series CONS and GDP.
Each group contains all of the unstacked series, providing you with easy access to all
of the series associated with the original stacked series. For example, the group GDP
contains the three series, GDPJPN, GDPUK, and GDPUS, while CONS contains
CONSJPN, CONSUK, and CONSUS.
Opening the GDP group spreadsheet, we see the result of unstacking the original
GDP series into three series: GDPJPN, GDPUK, and GDPUS. In particular, the values
of the GDPJPN and GDPUK series should be compared with the values of GDP
depicted in the group spreadsheet view of the stacked data.
Second, EViews has created a (date) series DATEID containing the distinct values of
the observation ID series. If necessary, this series will be used to structure the
unstacked workfile.
Lastly, EViews has created a pool object named COUNTRY, corresponding to the
specified unstack ID series, containing all of the unstacking identifiers. Since the
unstacked series have names that were created using the specified name pattern, this
pool object is perfectly set up for working with the unstacked data.
Stacking a Workfile
Stacking a workfile involves combining sets of series with related names into single
series, or repeatedly stacking individual series into single series, and placing the
results in a new workfile. The series in a given set to be stacked may be thought of as
containing repeated measures data on a given variable. The individual series may be
viewed as ordinary, non-repeated measures data.
The stacking operation depends crucially on the set of stacking identifiers. These
identifiers are used to determine the sets of series, and the number of times to repeat
the values of individual series.
In order for all of the series in a given set to be stacked, they must have names that
contain a common component, or base name, and the names must differ
systematically in containing an identifier. The identifiers can appear as a suffix, prefix,
or even in the middle of the base name, but they must be used consistently across all
series in each set.
Suppose, for example, we have a workfile containing the individual series Z, and the
two groups of series: XUS, XUK and XJPN, and US_Y, UK_Y, and JPN_Y. Note that
within each set of series, the identifiers “US,” “UK,” and “JPN” are used, and that they
are used consistently within each set of series.
If we employ the set of three identifier values “US,” “UK,” and “JPN” to stack our
workfile, EViews will stack the three series XUS, XUK, and XJPN on top of each other,
and the series US_Y, UK_Y, and JPN_Y on top of each other. Furthermore, the
individual series Z will be stacked on top of itself three times so that there are three
copies of the original data in the new series.
Stacking a Workfile in EViews
To stack the data in an existing workfile page, you should select Proc/Reshape
Current Page/Stack in New Page... from the main workfile menu. EViews will respond
by opening the tabbed Workfile Stack dialog.
There are two key pieces of information that you must provide in order to create a
stacked workfile: the set of stack ID values, and the series that you wish to stack. This
information should be provided in the two large edit fields. The remaining dialog
settings involve options that allow you to modify the method used to stack the series
and the destination of the stacked series.
Stacking Identifiers
There are three distinct methods that you may use to specify your stack ID values:
First, you may enter a space separated list containing the individual ID values (e.g.,
“1 2 3”, or “US UK JPN”). This is the most straightforward method, but can be
cumbersome if you have a large list of values.
Second, you may enter the name of an existing pool object that contains the identifier
values.
Lastly, you may instruct EViews to extract the ID values from a set of series
representing repeated measures on some variable. To use this method, you should
enter a series name pattern containing the base name and the “?” character in place
of the IDs. EViews will use this expression to identify a set of series, and will extract
the ID values from the series names. For example, if you enter “SALES?”, EViews will
identify all series in the workfile with names beginning with the string “SALES”, and
will form a list of identifiers from the remainder of the observed series names. In our
example, we have the series SALES1, SALES2, and SALES3 in the workfile, so that
the list of IDs will be “1”, “2”, and “3”.
Series to be Stacked
Next, you should enter the list of series, alphas, and links that you wish to stack. Sets
of series objects that are to be treated as repeated measures (stacked on top of each
other) should be entered using “?” series name patterns, while individual series (those
that should be repeatedly stacked on top of themselves), should be entered using
simple names or wildcards.
You may specify the repeated measures series by listing individual stacked series with
“?” patterns (“CONS? EARN?”), or you may use expressions containing the wildcard
character “*” (“*?” and “?C*”) to specify multiple sets of series. For example, entering
the expression “?C* ?E*” will tell EViews to find all repeated measures series that
begin with the letters “C” or “E” (e.g., “CONS? CAP? EARN? EXPER?”), and then to
stack (or interleave) the series using the list of stack ID values. If one of the series
associated with a particular stack ID does not exist, the corresponding stacked values
will be assigned the value NA.
Individual series may also be stacked. You may list the names of individual simple
series (e.g., “POP INC”), or you can specify your series using expressions containing
the wildcard character “*” (“*”, “*C”, “F*”). The individual series will repeatedly be
stacked (or interleaved), once for each ID value. If the target workfile page is in the
same workfile, EViews will create a link in the new page; otherwise, the stacked series
will contain repeated copies of the original values.
It should be noted that the wildcard values for individual series are processed after the
repeated measures series are evaluated, so that a given series will only be used once.
If a series is used as part of a repeated measures series, it will not be used when
matching wildcards in the list of individual series to be stacked.
The default value “*? *” is suitable for settings where the repeated series have names
formed by taking the base name and appending the stack ID values. The default will
stack all repeated measures series, and all remaining individual series (except for
RESID). Entering “*” alone will copy or link all series, but does not identify any repeated
measures series.
Naming Stacked Series
Stacked individual series will be named in the destination page using the name of the
series in the original workfile; stacked repeated measures series will, by default, be
named using the base name. For example, if you stack the repeated measures series
“SALES?” and the individual series GENDER, the corresponding stacked series will,
by default, be named “SALES” and “GENDER”, respectively.
This default rule will create naming problems when the base name of a repeated
measures series is also the name of an individual series. Accordingly, EViews allows
you to specify an alternative rule for naming your stacked repeated measures series
in the Name for stacked series section of the dialog.
The default naming rule may be viewed as one in which we form names by replacing
the “?” in the original specification with a blank space. To replace the “?” with a different
string, you should enter the desired string in the edit field. For example, if you enter
the string “_STK”, then EViews will name the stacked series “CONS?” and “EARN?”
as “CONS_STK” and “EARN_STK” in the destination workfile.
Stacking Order
EViews will, by default, create series in the new page by stacking series on top of one
another. If we have identifiers “1”, “2”, and “3”, and the series SALES1, SALES2, and
SALES3, EViews will stack the entire series SALES1 followed by the entire series
SALES2, followed by SALES3.
You may instruct EViews to interleave the data, by selecting the Interleaved radio
button in the Order of Obs section of the dialog. If selected, EViews will stack the first
observations for SALES1, SALES2, and SALES3, on top of the second observations,
and so forth.
It is worth pointing out that stacking by series means that the observations contained
in a given series will be kept together in the stacked form, while interleaving the data
implies that the multiple values for a given original observation will be kept together.
In some contexts, one form may be more natural than another.
In the case where we have time series data with different series representing different
countries, stacking the data by series means that we have the complete time series
for the “US” (USGDP), followed by the time series for the “UK” (UKGDP), and then
“JPN” (JPNGDP). This representation is more natural for time series analysis than
interleaving so that the observations for the first year are followed by the observations
for the second year, and so forth.
Alternatively, where the series represent repeated measures for a given subject,
stacking the data by series arranges the data so that all of the first measures are
followed by all of the second measures, and so on. In this case, it may be more natural
to interleave the data, so that all of the observations for the first individual are followed
by all of the observations for the second individual, and so forth.
One interesting case where interleaving may be desirable is when we have data which
has been split by period, within the year. For example, we may have four quarters of
data for each year:
If we stack the series using the identifier list “Q1 Q2 Q3 Q4”, we get the data:
Year ID01 X
2000 Q1 NA
2001 Q1 12.1
2000 Q2 5.6
2001 Q2 8.6
2000 Q3 8.7
2001 Q3 14.1
2000 Q4 9.6
2001 Q4 15.2
which is not ordered in the traditional time series format from earliest to latest. If
instead, we stack by “Q1 Q2 Q3 Q4” but interleave, we obtain the standard format:
Year ID01 X
2000 Q1 NA
2000 Q2 5.6
2000 Q3 8.7
2000 Q4 9.6
2001 Q1 12.1
2001 Q2 8.6
2001 Q3 14.1
2001 Q4 15.2
Note that since interleaving changes only the order of the observations in the workfile
and not the structure, we can always sort or restructure the workfile at a later date to
achieve the same effect.
Stacking Destination
By default, EViews will stack the data in a new page in the existing workfile named
“UNTITLED” (or the next available name, “UNTITLED1,” “UNTITLED2,” etc., if there
are existing pages in the workfile with the same name).
You may provide an alternative destination for the stacked data by clicking on the
Page Destination tab in the dialog, and entering the desired destination.
Here, we instruct EViews to put the stacked series in the workfile named STACKWF
in the named page ANNUALPANEL. If a page with that name already exists in the
workfile, EViews will create a new page using the next available name.
We note that if you are stacking individual series, there is an important consequence
of specifying a different workfile as the destination for your stacked series. If the target
page is in the same workfile as the original page, EViews will stack individual series
by creating link objects in the new page. These link objects have the standard
advantages of being memory efficient and dynamically updating. If, however, the
target page is in a different workfile, it is not possible to use links, so the stacked series
will contain repeated copies of the original individual series values.
An Example
Consider an annual (1971 to 2000) workfile, “Wfstack.WF1”, that contains the six
series: CONSUS, CONSUK, CONSJPN, and GDPUS, GDPUK, GDPJPN, along with
the ordinary series CONSTVAL and WORLDGDP.
We wish to stack series in a new page using the stack IDs: “US,” “UK,” and “JPN”.
Click on the Proc button and select Reshape Current Page/Stack in new Page....
We may specify the stacked series list explicitly by entering “US UK JPN” in the first
edit box, or we can instruct EViews to extract the identifiers from series names by
entering “GDP?”. Note that we cannot use “CONS?” in place of “GDP?” since the
presence of the ordinary series CONSTVAL means that “CONS?” is associated with
the wrong number of identifiers.
Assuming that we have entered “US UK JPN” or “GDP?” in the Stacking Identifiers
edit box, we may then enter the expression
gdp? cons?
as our Series to stack. We leave the remainder of the dialog settings at their defaults,
and click on OK.
EViews will first create a new page in the existing workfile and then will stack the
GDPUS, GDPUK, and GDPJPN series and the CONSUS, CONSUK, and CONSJPN
series. Since the dialog settings were retained at the default values, EViews will stack
the data by series, with all of the values of GDPUS followed by the values of GDPUK
and then the values GDPJPN, and will name the stacked series GDP and CONS.
Here we see the resulting workfile page ANNUAL_STK, containing the stacked series
GDP and CONS, as well as two EViews created series objects, ID01 and VAR01, that
contain identifiers that may be used to structure the workfile.
VAR01 is an alpha series that contains the stack ID values “US,” “UK,” and “JPN”
which are used as group identifiers, and ID01 is a data series containing the year
observation identifiers (more generally, VAR01 will contain the values of the
observation identifiers from the original page).
You may notice that EViews has already applied a panel structure to the page, so that
there are three cross-sections of annual data from 1971 to 2000, for a total of 90
observations.
Note that EViews will only apply a panel structure to the new page if we stack the data
by series, but not if we interleave observations. Had we chosen to interleave, we would
obtain a new 90 observation unstructured page containing the series GDP and CONS
and the alpha VAR01 and series ID01, with the observations for 1971 followed by
observations for 1972, and so forth.
We may add our individual series to the stacked series list, either directly by entering
their names, or using wildcard expressions. We may use either of the stack series
expressions:
gdp? cons? worldgdp constval
or
gdp? cons? *
to stack the various “GDP?” and “CONS?” series on top of each other, and the
individual series WORLDGDP and CONSTVAL will be linked to the new page so that
the original series values are repeatedly stacked on top of themselves.
It is worth reminding you that the wildcard values for individual series are processed
after the repeated measures series “GDP?” and “CONS?” are evaluated, so that a
given series will only be used once. Thus, in the example above, the series CONSUS
is used in forming the stacked CONS series, so that it is ignored when matching the
individual series wildcard.
If we had instead entered the stacking list
gdp? *
EViews would stack the various “GDP?” series on top of each other, and would treat
the remaining series as individual series so that the values of CONSUS, CONSUK,
CONSJPN, CONSTVAL, and WORLDGDP are repeated in the stacked page. In this
latter case, the wildcard implies that since the series CONSUS, CONSUK, and
CONSJPN are not used in forming a stacked repeated measures series, they are used
to create stacked individual series.
Lastly, we note that since EViews will, by default, create a new page in the existing
workfile, all individual series will be stacked or interleaved by creating link objects. If,
for example, you enter the stack series list
gdp? cons? worldgdp constval
the series WORLDGDP and CONSTVAL will be linked to the destination page using
the VAR01 values. Alternately, if we were to save the stacked data to a new workfile,
by clicking on the Page Destination tab and entering appropriate values, EViews will
copy the original WORLDGDP and CONSTVAL series to the new page, repeating the
values of the original series in the stacked series.
Popup
Sorting a Workfile
Basic data in workfiles are held in objects called series. If you click on Proc/Sort
Current Page … in the workfile toolbar, you can sort all of the series in an unstructured
workfile on the basis of the values of one or more of the series. A dialog box will open
where you can provide the details about the sort.
If you list two or more series, EViews uses the values of the second series to resolve
ties in the first series, and values of the third series to resolve ties in the first and
second, and so forth. If you wish to sort in descending order, select the appropriate
option in the dialog.
EViews will only sort unstructured workfiles since sorting a dated or structured workfile
will break the link between an observation and the corresponding date identifier.
If you attempt to sort a dated or structured workfile, EViews will display a warning
informing you that it will first unstructure your data, and then sort the data. Click on OK
to continue with the operation.
Popup
Popup
References
Baltagi, Badi H. (2005). Econometric Analysis of Panel Data, Third Edition, West
Sussex, England: John Wiley & Sons.
Gilley, O.W., and R. Kelley Pace (1996). “On the Harrison and Rubinfeld Data,”
Journal of Environmental Economics and Management, 31, 403–405.
Harrison, D. and D. L. Rubinfeld (1978). “Hedonic Housing Prices and the Demand for
Clean Air,” Journal of Environmental Economics and Management, 5, 81-102.
X. EViews Databases
An EViews database resembles a workfile in that it is used to contain a collection
of EViews objects. It differs from a workfile in two major ways. First, unlike a workfile,
the entire database need not be loaded into memory in order to access an object
inside it; an object can be fetched or stored directly to or from the database on disk.
Second, unlike a workfile page, the objects in a database are not restricted to being
of a single frequency or range. A database could contain a collection of annual,
monthly, and daily series, all with different numbers of observations.
EViews databases also differ from workfiles in that they support powerful query
features which can be used to search through the database to find a particular series
or a set of series with a common property. This makes databases ideal for managing
large quantities of data.
While EViews has its own native storage format for databases, EViews also
allows direct access to data stored in a variety of other formats through the same
database interface. You can perform queries, copy objects to and from workfiles and
other databases, and rename and delete objects within a database, all without
worrying about in what format the data are actually stored
Database Overview
An EViews database is a set of files containing a collection of EViews objects. In
this chapter we describe how to:
• Create a new database or open an existing database.
• Work with objects in the database, including how to store and fetch objects into
workfiles, and how to copy, rename and delete objects in the database.
• Use auto-series to work with data directly from the database without creating a copy
of the data in the workfile.
• Use the database registry to create shortcuts for long database names and to set
up a search path for series names not found in the workfile.
• Perform a query on the database to get a list of objects with particular properties.
• Use object aliases to work with objects whose names are illegal or awkward.
• Maintain a database with operations such as packing, copying, and repairing.
• Work with remote database links to access data from remote sites.
Database Basics
What is an EViews Database?
An EViews native format database consists of a set of files on disk. There is a
main file with the extension .EDB which contains the actual object data, and a number
of index files with extensions such as .E0, .E1A and .E1B which are used to speed up
searching operations on the database. In normal use, EViews manages these files for
the user, so there is no need to be aware of this structure. However, if you are copying,
moving, renaming, or deleting an EViews database from outside of EViews (using
Windows Explorer for example), you should perform the operation on both the main
database file and all the index files associated with the database. If you accidentally
delete or damage an index file, EViews can regenerate it for you from the main data
file using the repair command (see “Maintaining the Database”).
The fact that EViews databases are kept on disk rather than in memory has some
important consequences. Any changes made to a database cause immediate
changes to be made to the disk files associated with the database. Therefore, unlike
workfiles, once a change is made to a database, there is no possibility of discarding
the change and going back to the previously saved version. Because of this, you
should take care when modifying a database, and should consider keeping regular
backup copies of databases which you modify frequently.
EViews also allows you to deal with a variety of foreign format databases through
the same interface provided to EViews’ native format databases. Foreign databases
can have many different forms, including files on disk, or data made available through
some sort of network server. See “Foreign Format Databases” for a discussion of the
different types of foreign databases that EViews can access.
Creating a Database
To create a database, simply select File/New/Database… from the main menu.
For a native EViews database, simply enter a name for the database in the field
labeled DB File name/path, then click on the button marked OK. This will create a new
EViews database in the current path.
To create a database in a different directory, you can enter the full path and
database name in the DB File name/path edit field. Alternatively, you can browse to
the desired directory. Simply click on the Browse Files button to call up the common
file dialog, and then navigate to the target directory. Enter the name of the new
database in the File name edit field, then click on the OK button to accept the
information and close the file dialog. EViews will put the new path and filename in the
DB File name/path edit field.
The Database/File Type field allows you to create different types of databases.
See “Foreign Format Databases” for a discussion of working with different database
types.
The Open As field allows you to specify the shorthand that will be associated
with this database. A shorthand is a short text label which is used to refer to the
database in commands and programs. If you leave this field blank, a default shorthand
will be assigned automatically (see “Database Shorthands”).
The Browse Registry and Add to Registry buttons provide a convenient way to
recall information associated with a previously registered database or to include the
new database in the database registry (see “The Database Registry”).
A database can also be created from the command line or in a program using the
command:
dbcreate db_name
where db_name is the name of the database using the same rules given above.
The Database Window
When you create a new database, a database window will open on the screen.
The database window provides a graphical interface which allows you to query
the database, copy-and-paste objects to and from your workfile, and perform basic
maintenance on the database. Note that some database operations can also be
carried out directly without first opening the database window.
To open a database window for an existing database, select
File/Open/Database… from the main menu. The same dialog will appear as was used
during database creation. To open an EViews database, use the Browse Files button
to select a file using the common file dialog, then click on OK to open the file. A new
window should appear representing the open database.
From the command line or in a program, you can open a database window by
typing:
dbopen db_name
Unlike a workfile window, a database window does not display the contents of
the database when it is first opened, although it does tell you how many objects are in
the database. The second line of the window text shows the number of objects
currently displayed (zero when the window is first opened) followed by the total
number of objects stored in the database.
You can bring up an alphabetical listing of every object in the database by
clicking on the All button:
As for a workfile, each object is preceded by a small icon that identifies the type
of the object. When performing an All query, no other information about the object is
visible. However, by double clicking on an object you can bring up a full description of
the object including its name, type, modification date, frequency, start and end date
(for series), and label.
For large databases, the All button generally displays too many objects and not
enough information about each object. The database query features (“Querying the
Database”) allow you to control precisely which objects should be displayed, and what
information about each object should be visible. The text form of the query currently
being displayed is always visible in the top line of the database window.
When working with foreign databases, the object names may appear in color to
indicate that they are illegal names or that an alias has been attached to an object
name (see “Object Aliases and Illegal Names”).
The “Packable space” field in the database window displays the percentage of
unused space in the database that can be recovered by a database pack operation
(see “Packing the Database”).
A brief technical note: having a database window open in EViews generally does
not keep a file open at the operating system level. EViews will normally open files only
when it is performing operations on those files. Consequently, multiple users may have
a database open at the same time and can perform operations simultaneously. There
are some limits imposed by the fact that one user cannot read from a database that
another user is writing to at the same time. However, EViews will detect this situation
and continue to retry the operation until the database becomes available. If the
database does not become available within a specified time, EViews will generate an
error stating that a “sharing violation” on the database has occurred.
For some foreign formats, even minor operations on a database may require full
rewriting of the underlying file. In these cases, EViews will hold the file open as long
as the database window is open in order to improve efficiency. The formats that
currently behave this way are Aremos TSD files, RATS Portable files and TSP portable
files. When using these formats, only one user at a time may have an open database
window for the file.
Database Shorthands
In many situations, EViews allows you to prefix an object name with a database
identifier to indicate where the series is located. These database identifiers are
referred to as “shorthands”. For example, the command:
fetch db1::x db2::y
indicates to EViews that the object named X is located in the database with the
shorthand db1 and the object named y is located in the database with the shorthand
db2.
Whenever a database is opened or created, it is assigned a shorthand. The
shorthand can be specified by the user in the Open as field when opening a database,
or using the “As” clause in the dbopen command (see dbopen). If a shorthand is
explicitly specified when opening a database, an error will occur if the shorthand is
already in use.
If no shorthand is provided by the user, a shorthand is assigned automatically.
The default value will be the name of the database after any path or extension
information has been removed. If this shorthand is already in use, either because a
database is already open with the same name, or because an entry in the database
registry already uses the name, then a numerical suffix is appended to the shorthand,
counting upwards until an unused shorthand is found.
For example, if we open two databases with the same name in a program:
dbopen test.edb
dbopen test.dat
then the first database will receive the shorthand “TEST” and the second database will
receive the shorthand “TEST1”. If we then issue the command:
fetch test::x
the object X will be fetched from the EViews database TEST.EDB. To fetch X from the
Haver database TEST.DAT we would use:
fetch test1::x
To minimize confusion, you should assign explicit shorthands to databases whenever
ambiguity could arise. For example, we could explicitly assign the shorthand
test_haver to the second database by replacing the second dbopen command with:
dbopen test.dat as test_haver
The shorthand attached to a database remains in effect until the database is closed.
The shorthand assigned to an open database is displayed in the title bar of the
database window.
The Default Database
In order to simplify common operations, EViews uses the concept of a default
database. The default database is used in several places, the most important of which
is as the default source or destination for store or fetch operations when an alternative
database is not explicitly specified.
The default database is set by opening a new database window, or by clicking on an
already open database window if there are multiple databases open on the screen.
The name of the default database is listed in the status line at the bottom of the main
EViews window (see “Object Basics”, for details). The concept is similar to that of the
current workfile with one exception: when there are no currently open databases there
is still a default database; when there are no currently open workfiles, the current
workfile is listed as “none.”
EViews .DB? files
Early versions of EViews and MicroTSP supported a much more limited set of
database operations. Objects could be stored on disk in individual files, with one object
per file. Essentially, the disk directory system was used as a database and each
database entry had its own file. These files had the extension “.DB” for series, and
.DB followed by an additional character for other types of objects. EViews refers to
these collectively as .DB? files.
While the new database features added to EViews provide a superior method of
archiving and managing your data, .DB? files provide backward compatibility and a
convenient method of distributing data to other programs. Series .DB files are now
supported by a large number of programs including TSP, RATS, and SHAZAM.
Additionally, some organizations such as the National Bureau of Economic Research
(NBER), distribute data in .DB format.
Working with Objects in 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.
Database Auto-Series
We have described how to fetch series into a workfile. There is an alternative way of
working with databases which allows you to make direct use of the series contained
in a database without first copying the series. The advantage of this approach is that
you need not go through the process of importing the data every time the database is
revised. This approach follows the model of auto-series in EViews as described in
“Auto-series”.
There are many places in EViews where you can use a series expression, such as
log(X), instead of a simple series name, and EViews will automatically create a
temporary auto-series for use in the procedure. This functionality has been extended
so that you can now directly refer to a series in a database using the syntax:
db_name::object_name
where db_name is the shorthand associated with the database. If you omit the
database name and simply prefix the object name with a double colon like this:
::object_name
EViews will look for the object in the default database.
A simple example is to generate a new series:
series lgdp = log(macro_db::gdp)
EViews will fetch the series named GDP from the database with the shorthand
MACRO_DB, and put the log of GDP in a new series named LGDP in the workfile. It
then deletes the series GDP from memory, unless it is in use by another object. Note
that the generated series LGDP only contains data for observations within the current
workfile sample.
You can also use auto-series in a regression. For example:
equation eq1.ls log(db1::y) c log(db2::x)
This will fetch the series named Y and X from the databases named DB1 and DB2,
perform any necessary frequency conversions and end point truncation so that they
are suitable for use in the current workfile, take the log of each of the series, then run
the requested regression. Y and X are then deleted from memory unless they are
otherwise in use.
The auto-series feature can be further extended to include automatic searching of
databases according to rules set in the database registry (see “The Database
Registry”). Using the database registry you can specify a list of databases to search
whenever a series you request cannot be found in the workfile. With this feature
enabled, the series command:
series lgdp = log(gdp)
looks in the workfile for a series named GDP. If it is not found, EViews will search
through the list of databases one by one until a series called GDP is found. When
found, the series will be fetched into EViews so that the expression can be evaluated.
Similarly, the regression:
equation logyeq.ls log(y) c log(x)
will fetch Y and X from the list of databases in the registry if they are not found in the
workfile. Note that the regression output will label all variables with the database name
from which they were imported.
In general, using auto-series directly from the database has the advantage that the
data will be completely up to date. If the series in the database are revised, you do not
need to repeat the step of importing the data into the workfile. You can simply
reestimate the equation or model, and EViews will automatically retrieve new copies
of any data which are required.
There is one complication to this discussion which results from the rules which
regulate the updating and deletion of auto-series in general. If there is an existing copy
of an auto-series already in use in EViews, a second use of the same expression will
not cause the expression to be reevaluated (in this case reloaded from the database);
it will simply make use of the existing copy. If the data in the database have changed
since the last time the auto-series was loaded, the new expression will use the old
data.
One implication of this behavior is that a copy of a series from a database can persist
for any length of time if it is stored as a member in a group. For example, if you type:
show db1::y db2::x
this will create an untitled group in the workfile containing the expressions db1::y and
db2::x. If the group window is left open and the data in the database are modified (for
example by a store or a copy command), the group and its window will not update
automatically. Furthermore, if the regression:
equation logyeq.ls log(db1::y) c log(db2::x)
is run again, this will use the copies of the series contained in the untitled group; it will
not re-fetch the series from the database.
The Database Registry
The database registry is a file on disk that manages a variety of options which
control database operations. It gives you the ability to assign short alias names that
can be used in place of complete database paths, and also allows you to configure
the automatic searching features of EViews.
Long database names such as these also cause output labels to truncate, making it
difficult to see which series were used in a procedure.
By assigning full database path and name the alias DRI, we may employ the more
readable command:
equation eq1.ls dri::gdp c dri::gdp(-1)
and the regression output will be labeled with the shorter names. To minimize the
possibility of truncation, we recommend the use of short alias names if you intend to
make use of database auto-series.
Finally, you should tell EViews if you want to include the database in automatic
database searches by checking the Include in auto search checkbox. Click on OK to
add your entry to the list
Any registry entry may be edited, deleted, switched on or off for searching, or moved
to the top of the search order by highlighting the entry in the list and clicking the
appropriate button to the right of the list box.
The remainder of the Database Registry dialog allows you to set options for automatic
database searching. The Auto-search checkbox is used to control EViews behavior
when you enter a command involving a series name which cannot be found in the
current workfile. If this checkbox is selected, EViews will automatically search all
databases that are registered for searching, before returning an error. If a series with
the unrecognized name is found in any of the databases, EViews will create a
database auto-series and continue with the procedure.
The last section of the dialog, Default Database in Search Order, lets you specify how
the default database is treated in automatic database searches. Normally, when
performing an automatic search, EViews will search through the databases contained
in the Registry Entries window in the order that they are listed (provided that the
Include in auto search box for that entry has been checked). These options allow you
to assign a special role to the default database when performing a search.
• Include at start of search order—means that the current default database will be
searched first, before searching the listed databases.
• Include at end of search order—means that the current default database will be
searched last, after searching the listed databases.
• Do not include in search—means that the current default database will not be
searched unless it is already one of the listed databases.
Querying the Database
A great deal of the power of the database comes from its extensive query
capabilities. These capabilities make it easy to locate a particular object, and to
perform operations on a set of objects which share similar properties.
The query capabilities of the database can only be used interactively from the
database window. There are two ways of performing a query on the database: the
easy mode and the advanced mode. Both methods are really just different ways of
building up a text query to the database. The easy mode provides a simpler interface
for performing the most common types of queries. The advanced mode offers more
flexibility at the cost of increased complexity.
Easy Queries
To perform an easy query, first open the database, then click on the Easy Query button
in the toolbar at the top of the database window. The Easy Query dialog will appear
containing two text fields and a number of check boxes:
There are two main sections to this dialog: Select and Where. The Select section
determines which fields to display for each object that meets the query condition. The
Where section allows you to specify conditions that must be met for an object to be
returned from the query. An Easy Query allows you to set conditions on the object
name, object description, and/or object type.
The two edit fields (name and description) and the set of check boxes (object
type) in the Where section provide three filters of objects that are returned from the
query to the database. The filters are applied in sequence (using a logical ‘and’
operation) so that objects in the database must meet all of the criteria selected in order
to appear in the results window of the query.
The name and description fields are each used to specify a pattern expression
that the object must meet in order to satisfy the query. The simplest possible pattern
expression consists of a single pattern. A pattern can either be a simple word
consisting of alphanumeric characters, or a pattern made up of a combination of
alphanumeric characters and the wildcard symbols “?” and “*”, where “?” means to
match any one character and “*” means to match zero or more characters. For
example:
pr?d*ction
would successfully match the words production, prediction, and predilection.
Frequently used patterns include “s*” for words beginning in “S,” “*s” for words ending
in “S,” and “*s*” for words containing “S.” Upper or lower case is not significant when
searching for matches.
Matching is done on a word-by-word basis, where at least one word in the text must
match the pattern for it to match overall. Since object names in a database consist of
only a single word, pattern matching for names consists of simply matching this word.
For descriptions, words are constructed as follows: each word consists of a set of
consecutive alphanumeric characters, underlines, dollar signs, or apostrophes.
However, the following list words are explicitly ignored: “a,” “an,” “and,” “any,” “are,”
“as,” “be,” “between,” “by,” “for,” “from,” “if,” “in,” “is,” “it,” “not,” “must,” “of,” “on,” “or,”
“should,” “that,” “the,” “then,” “this,” “to,” “with,” “when,” “where,” “while.” (This is done
for reasons of efficiency, and to minimize false matches to patterns from uninteresting
words.) The three words “and,” “or,” and “not” are used for logical expressions.
For example:
bal. of p’ment: seas.adj. by X11
is broken into the following words: “bal,” “p’ment,” “seas,” “adj,” and “x11.” The words
“of” and “by” are ignored.
A pattern expression can also consist of one or more patterns joined together with the
logical operators “and,” “or,” and “not” in a manner similar to that used in evaluating
logical expressions in EViews. That is, the keyword and requires that both the
surrounding conditions be met, the keyword or requires that either of the surrounding
conditions be met, and the keyword not requires that the condition to the right of the
operator is not met. For example:
s* and not *s
matches all objects which contain words which begin with, but do not end with, the
letter “S”.
More than one operator can be used in an expression, in which case parentheses can
be added to determine precedence (the order in which the operators are evaluated).
Operators inside parentheses are always evaluated logically prior to operators outside
parentheses. Nesting of parentheses is allowed. If there are no parentheses, the
precedence of the operators is determined by the following rules: not is always applied
first; and is applied second; and or is applied last. For example:
p* or s* and not *s
matches all objects which contain words beginning with P, or all objects which contain
words which begin with, but do not end with, the letter S.
The third filter provided in the Easy Query dialog is the ability to filter by object type.
Simply select the object types which you would like displayed, using the set of check
boxes near the bottom of the dialog.
Advanced Queries
Advanced queries allow considerably more control over both the filtering and the
results which are displayed from a query. Because of this flexibility, advanced queries
require some understanding of the structure of an EViews database to be used
effectively.
Each object in an EViews database is described by a set of fields. Each field is
identified by a name. The current list of fields includes:
An advanced query allows you to examine the contents of any of these fields,
and to select objects from the database by placing conditions on these fields. An
advanced query can be performed by opening the database window, then clicking on
the button marked Query in the toolbar at the top of the window. The Advanced Query
dialog is displayed.
The first edit field labeled Select: is used to specify a list of all the fields that you
would like displayed in the query results. Input into this text box consists of a series of
field names separated by commas. Note that the name and type fields are always
fetched automatically.
The ordering of display of the results of a query is determined by the Order By
edit field. Any field name can be entered into this box, though some fields are likely to
be more useful than others. The description field, for example, does not provide a
useful ordering of the objects. The Order By field can be useful for grouping together
objects with the same value of a particular field. For example, ordering by type is an
effective way to group together the results so that objects of the same type are placed
together in the database window. The Ascending and Descending buttons can be
used to reverse the ordering of the objects. For example, to see objects listed from
those most recently written in the database to those least recently written, one could
simply sort by the field last_write in Descending order.
The Where edit field is the most complicated part of the query. Input consists of a
logical expression built up from conditions on the fields of the database. The simplest
expression is an operator applied to a single field of the database. For example, to
search for all series which are of monthly or higher frequencies (where higher
frequency means containing more observations per time interval), the appropriate
expression is:
freq >= monthly
Field expressions can also be combined with the logical operators and, or and
not with precedence following the same rules as those described above in the section
on easy queries. For example, to query for all series of monthly or higher frequencies
which begin before 1950, we could enter the expression:
freq >= monthly and start < 1950
Each field has its own rules as to the operators and constants which can be used with
the field.
Name
The name field supports the operators “<“, “<=”, “>”, “>=”, “=”, and “<>” to perform
typical comparisons on the name string using alphabetical ordering. For example,
name >= c and name < m
will match all objects with names beginning with letters from C to L. The name field
also supports the operator “matches”. This is the operator which is used for filtering
the name field in the easy query and is documented extensively in the previous
section. Note that if matches is used with an expression involving more than one word,
the expression must be contained in quotation marks. For example,
name matches "x* or y*" and freq = quarterly
is a valid query, while
name matches x* or y* and freq = quarterly
is a syntax error because the part of the expression that is related to the matches
operator is ambiguous.
Type
The type field can be compared to the standard EViews object types using the “=”
operator and the keywords: alpha, coef, equation, factor, graph, group, logl, matrix,
model, pool, sample, scalar, series, spool, sspace, string, svector, sym, system, table,
text, var, vector. Relational operators are defined for the type field, although there is
no particular logic to the ordering. The ordering can be used, however, to group
together objects of similar types in the Order By field.
Freq
The frequency field has one of the following values:
Any word beginning with the letter above is taken to denote that particular frequency,
so that monthly can either be written as “m” or “monthly”. Ordering over frequencies
is defined so that a frequency with more observations per time interval is considered
“greater” than a series with fewer observations per time interval. The operators “<”,
“>”, “<=”, “>=”, “=”, “<>” are all defined according to these rules. For example,
freq <= quarterly
will match objects whose frequencies are quarterly, semiannual, annual or undated.
Start and End
Start and end dates use the following representation. A date from an annual series is
written as an unadorned year number such as “1980”. A date from a semiannual series
is written as a year number followed by an “S” followed by the six month period, for
example “1980S2”. The same pattern is followed for quarterly and monthly data using
the letters “Q” and “M” between the year and period number. Weekly, 5-day daily, and
7-day daily data are denoted by a date in the format:
mm/dd/yyyy
where m denotes a month digit, d denotes a day digit, and y denotes a year digit.
Operators on dates are defined in accordance with calendar ordering where an earlier
date is less than a later date. Where a number of days are contained in a period, such
as for monthly or quarterly data, an observation is ordered according to the first day
of the period. For example:
start <= 1950
will include dates whose attributed day is the first of January 1950, but will not include
dates which are associated with other days in 1950, such as the second, third, or
fourth quarter of 1950. However, the expression:
start < 1951
would include all intermediate quarters of 1950.
Last_write and Last_update
As stated above, last_write refers to the time the object was written to disk, while
last_update refers to the time the object was last modified inside EViews. For example,
if a new series was generated in a workfile, then stored in a database at some later
time, last_write would contain the time that the store command was executed, while
last_update would contain the time the new series was generated. Both of these fields
contain date and time information which is displayed in the format:
mm/dd/yyyy hh:mm
where m represents a month digit, d represents a day digit, y represents a year digit,
h represents an hour digit and m represents a minute digit.
The comparison operators are defined on the time fields so that earlier dates and times
are considered less than later dates and times. A typical comparison has the form:
last_write >= mm/dd/yyyy
A day constant always refers to twelve o’clock midnight at the beginning of that day.
There is no way to specify a particular time during the day.
Description, Source, Units, Remarks, History, Display_name
These fields contain the label information associated with each object (which can be
edited using the Label view of the object in the workfile). Only one operator is available
on these fields, the matches operator, which behaves exactly the same as the
description field in the section on easy queries.
Query Examples
Suppose you are looking for data related to gasoline consumption and gasoline prices
in the database named DRIBASIC. First open the database: click File/Open, select
Files of type: Database.edb and locate the database. From the database window, click
Query and fill in the Advanced Query dialog as follows:
Select: name, type, freq, description
Where: description matches gasoline
If there are any matches, the results are displayed in the database window similar to
the following:
To view the contents of all fields of an item, double click on its name. EViews will open
an Object Description window that looks as follows:
To further restrict your search to series with at least quarterly frequency and to display
the start and end dates of the results, click Query and again and modify the fields as
follows:
Select: name, type, start, end, description
Where: description matches gasoline and freq>=q
If you are interested in seasonally adjusted series, which happen to contain sa or saar
in their description in this database, further modify the fields to
Select: name, type, start, end, description
Where: description matches "gasoline and (sa or saar)" and freq>=q
The display of the query results now looks as follows:
The columns of the database display can be reordered by dragging each to its
desired location, or resized by dragging the column header’s right edge. You can also
sort by any of the columns by clicking the column header to alternate between
ascending and descending sort.
By adding columns, the database display can be customized to provide
additional information and grouping capabilities. See “Workfile Details Display” for a
thorough discussion of customized attributes in this view. Most importantly, it
describes how to view all available attributes in the database, by right-clicking in a
column header and selecting Edit Columns.... The methods presented in the
discussion detail how you can view specific characteristics across all items in your
database.
Object Aliases and Illegal Names
When working with a database, EViews allows you to create a list of aliases for each
object in the database so that you may refer to each object by a different name. The
most important use of this is when working with a database in a foreign format where
some of the names used in the database are not legal EViews object names. However,
the aliasing features of EViews can also be used in other contexts, such as to assign
a shorter name to a series with an inconveniently long name.
The basic idea is as follows: each database can have one or more object aliases
associated with it where each alias entry consists of the name of the object in the
database and the name by which you would like it to be known in EViews.
The easiest way to create an object alias for an illegal name is to attempt to fetch the
object with the illegal name into EViews. If you are working with query results, you can
tell which object names are illegal because they will be displayed in the database
window in red. When you try to fetch an object with an illegal name, a dialog will
appear.
The field labeled EViews Name initially contains the illegal name of the database
object. You should edit this to form a legal EViews object name. In this example, we
could change the name C to CONSUMP. The checkbox labeled Add this name to the
database alias list (which is not checked by default), determines whether you want to
create a permanent association between the name you have just typed and the illegal
name. If you check the box, then whenever you use the edited object name in the
future, EViews will take it to refer to the underlying illegal name. The edited name acts
as an alias for the underlying name. It is as though you had renamed the object in the
database to the new legal name, except that you have not actually modified the
database itself, and your changes will not affect other users of the database.
When EViews displays an object in the database window for which an alias has
been set, EViews will show the alias, rather than the underlying name of the object. In
order to indicate that this substitution has been done, EViews displays the name of
the aliased object in blue.
Creating an alias can cause shadowing of object names. Shadowing occurs
when you create an alias for an object in the database, but the name you use as an
alias is the name of another object in the database. Because the existence of the alias
will stop you from accessing the other object, that object is said to be shadowed. To
indicate that an object name being displayed has been shadowed, EViews displays
the name of shadowed objects in green. You will not be able to fetch an object which
has been shadowed without modifying either its name or the alias which is causing it
to be shadowed. Even if the shadowed series is explicitly selected with the mouse,
operations performed on the series will use the series with the conflicting alias, not the
shadowed series.
You can view a list of the aliases currently defined for any database by clicking
on the View button at the top of the database window, then selecting Object Aliases.
A list of all the aliases will be displayed in the window.
Each line represents one alias attached to the database and follows the format:
alias = database_object_name
You can edit the list of aliases to delete unwanted entries, or you can type in, or
cut-and-paste, new entries into the file. You must follow the rule that both the set of
aliases and the set of database names do not contain any repeated entries. (If you do
not follow this rule, EViews will refuse to save your changes). To save any
modifications you have made, simply switch back to the Object Display view of the
database. EViews will prompt you for whether you want to save or discard your edits.
The list of currently defined database aliases for all databases is kept in the file
OBALIAS.INI in the EViews installation directory. If you would like to replicate a
particular set of aliases onto a different machine, you should copy this file to the other
machine, or use a text editor to combine a portion of this file with the file already in
use on the other machine. You must exit and restart EViews to be sure that EViews
will reread the aliases from the file.
Maintaining the Database
In many cases an EViews database should function adequately without any
explicit maintenance. Where maintenance is necessary, EViews provides a number
of procedures to help you perform common tasks.
Database File Operations
Because EViews databases are spread across multiple files, all of which have
the same name but different extensions, simple file operations like copy, rename and
delete require multiple actions if performed outside of EViews. The Proc button in the
database window toolbar contains the procedures Copy the database, Rename the
database, and Delete the database that carry out the chosen operation on all of the
files that make up the database.
Note that file operations do not automatically update the database registry. If you
delete or rename a database that is registered, you should either create a new
database with the same name and location, or edit the registry.
Packing the Database
If many objects are deleted from an EViews database without new objects being
inserted, a large amount of unused space will be left in the database. In addition, if
objects are frequently overwritten in the database, there will be a tendency for the
database to grow gradually in size. The extent of growth will depend on the
circumstances, but a typical database is likely to stabilize at a size around 60% larger
than what it would be if it were written in a single pass.
A database can be compacted down to its minimum size by using the pack
procedure. Simply click on the button marked Proc in the toolbar at the top of the
database window, then select the menu item Pack the Database. Depending on the
size of the database and the speed of the computer which you are using, performing
this operation may take a significant amount of time.
You can get some idea of the amount of space that will be reclaimed during a pack by
looking at the Packable Space percentage displayed in the top right corner of the
database window. A figure of 30%, for example, indicates that roughly a third of the
database file consists of unused space. A more precise figure can be obtained from
the Database Statistics view of a database. The number following the label “unused
space” gives the number of unused bytes contained in the main database file.
Dealing with Errors
EViews databases are quite robust, so you should not experience problems
working with them on a regular basis. However, as with all computer files, hardware
or operating system problems may produce conditions under which your database is
damaged.
The best way to protect against damage to a database is to make regular backup
copies of the database. This can be performed easily using the Copy the Database
procedure documented above. EViews provides a number of other features to help
you deal with damaged databases.
Damaged databases can be divided into two basic categories depending on how
severely the database has been damaged. A database which can still be opened in a
database window but generates an error when performing some operations may not
be severely damaged and may be reparable. A database which can no longer be
opened in a database window is severely damaged and will need to be rebuilt as a
new database.
EViews has two procedures designed for working with databases which can be
opened: Test Database Integrity and Repair Database. Both procedures are accessed
by clicking on the button marked Proc in the database window toolbar, then selecting
the appropriate menu item.
Test Database Integrity conducts a series of validity checks on the main
database and index files. If an error is detected, a message box will be displayed,
providing some information as to the type of error found and a suggestion as to how it
might be dealt with. Because testing performs a large number of consistency checks
on the database files, it may take considerable time to complete. You can monitor its
progress by watching the messages displayed in the status line at the bottom of the
EViews window. Testing a database does not modify the database in any way, and
will never create additional damage to a database.
Repair Database will attempt to automatically detect and correct simple problems in
the database. Although care has been taken to make this command as safe as
possible, it will attempt to modify a damaged database, so it is probably best to make
a back up copy of a damaged database before running this procedure.
Rebuilding the Database
If the database is badly corrupted, it may not be possible for it to be repaired. In this
case, EViews gives you the option of building a new database from the old one using
the dbrebuild command. This operation can only be performed from the command line
(since it may be impossible to open the database). The command is:
dbrebuild old_dbname new_dbname
The dbrebuild command does a low level scan through the main data file of the
database old_dbname looking for any objects which can be recovered. Any such
objects are copied into the new database new_dbname. This is a very time consuming
process, but it will recover as much data as possible from even heavily damaged files.
Foreign Format Databases
While most of your work with databases will probably involve using EViews native
format databases, EViews also gives you the ability to access data stored in a variety
of other formats using the same database interface. You can perform queries, copy
objects to and from workfiles and other databases, rename and delete objects within
the database, add databases to your search path, and use EViews’ name aliasing
features, all without worrying about how the data are stored.
When copying objects, EViews preserves not only the data itself, but as much as
possible of any date information and documentation associated with the object.
Missing values are translated automatically.
To Convert or Not to Convert?
Although EViews allows you to work with foreign files in their native format, in some
cases you may be better off translating the entire foreign file into EViews format. If
necessary, you can then translate the entire file back again when your work is
complete. EViews native databases have been designed to support a certain set of
operations efficiently, and while access to foreign formats has been kept as fast as
possible, in some cases there will be substantial differences in performance
depending on the format in use.
One significant difference is the time taken to search for objects using keywords in the
description field. If the data are in EViews format, EViews can typically query
databases containing tens of thousands of series in a couple of seconds. When
working with other formats, you may find that this same operation takes much longer,
with the time increasing substantially as the database grows.
On the other hand, keeping the data in the foreign format may allow you to move
between a number of applications without having to retranslate the file. This minimizes
the number of copies of the data you have available, which may make the data easier
to update and maintain.
Using EViews, you can either translate your data or work with your data directly in the
foreign format. You should choose between the two based on your particular needs.
Opening a Foreign Database
Working with foreign formats requires very little additional knowledge. To open a
foreign database, simply select File/Open/Database... from the main menu to open
the dialog. In the field Database/File Type: select the type of the foreign database or
file you wish to open. If the database is a local file, you can then use the Browse Files
button to locate the database in exactly the same way as for a native EViews
database. You can create a new foreign format database by a similar procedure way
using File/New/Database... from the main EViews menu.
If the database is accessed through a client-server model, selecting the dialog will
change to show extra fields necessary for making the connection to the server. For
example, when accessing a database located on a FAME server, the dialog will
include fields for the FAME server, username and password.
Since access to a server requires many fields to be entered, you may wish to save
this information as an entry in the database registry (see “The Database Registry” for
details).
There are special issues relating to working with DRIPro links. See “DRIPro Link” for
details.
You can also create and open foreign format files using the dbopen or dbcreate
commands. You may either use an option to specify the foreign type explicitly, or let
EViews determine the type using the file extension. See dbopen and dbcreate for
details.
Copying a Foreign Database
Once you have opened a window to a foreign database, you can copy the entire
database into a new format using Proc/Copy the Database from the database menus.
A dialog will appear which allows you to specify the type and other attributes of the
new database you would like to create.
When performing a database copy to a new format, objects which cannot be copied
due to incompatibility between formats will result in error messages in the EViews
command window but will not halt the copying process. Upon completion, a message
in the status line reports how many objects could not be copied.
Notes on Particular Formats
AREMOS
EViews allows you to open and access data in AREMOS data banks using the
standard EViews database interface. Bear in mind that there are a few limitations
when working with AREMOS data banks:
• EViews can only translate series, matrix and list objects. AREMOS models and
equations will be displayed in a database query, but cannot be imported into EViews.
AREMOS list objects are translated into string objects inside EViews, with AREMOS
comma delimited lists translated into EViews space delimited lists so that they can
easily be used in EViews for loops and with the EViews “word” manipulation functions
that begin with the “@w”).
• EViews does not support the following AREMOS frequencies: two-monthly, lunar,
periodic and daily with non-consecutive days of the week. All other frequencies should
be supported. Series with unsupported frequencies will be read into EViews as
“undated” series. Note that series containing weekly data should be translated
correctly, but will be labeled slightly differently in AREMOS and EViews since EViews
labels each observation with the first day of the week and AREMOS labels each
observation with the last day of the week. (You can use the @enddate series in
EViews to display the same dates that AREMOS would use for each observation).
• EViews cannot handle databanks that contain multiple objects with the same name
and version (but different object types). Queries that return more than one object with
the same name and version cause EViews to error, and fetching objects with one of
these shared names is unreliable.
• EViews does not add/hide default versions to the end of names based on the working
frequency in the same way that AREMOS does. AREMOS versions are simply treated
as part of the object name. Since the dot character is illegal in EViews object names,
this means that most objects in an AREMOS databank have illegal names. There are
a variety of mechanisms in EViews to help users to work with objects with illegal
names which will automatically come into play when working with AREMOS
databanks. (The default outcome is that the dot that separates the name and version
in Aremos will become an underscore when the object is moved into an EViews
workfile or database).
Note also that there are special rules for handling AREMOS frequencies when fetching
AREMOS data into EViews. See “Special Handling of Frequencies” for discussion.
AREMOS TSD
The TSD format is a portable ASCII file format written by the AREMOS package. The
EViews database tools provide an intuitive graphical interface to the data, and allows
you to move data directly in and out of an EViews database without having to move
the data through a workfile (which may force the data to be converted to a single
frequency).
Bloomberg
EViews Enterprise Edition users may use the standard EViews database interface to
search, browse, and retrieve Bloomberg Reference Data Services extensive library
market and economic data.
You can search through Bloomberg securities and fields from within EViews to quickly
locate the data you need, then fetch the data directly into an EViews workfile without
the need for intermediate files or formats.
To access Bloomberg data from EViews, you must have:
1. The Bloomberg Professional application software installed on your machine
2. A currently active subscription to Bloomberg and be able to log into the Bloomberg
Professional terminal on your machine.
In most cases, you should simply be able to click on OK to get started. Clicking on OK
should bring up a Bloomberg database window.
• The Search Text field allows you to enter one or more keywords to search for. The
‘Market Sector’ field lets you restrict the search to a particular Bloomberg market
sector. (If you are using a Bloomberg keyboard you can change the market sector field
by pressing a Yellow Key).
• The Items to Return field specifies how many items to return from the search.
Bloomberg is very effective at selecting relevant results so only a small number of
results is generally needed.
• The Field Name and Overrides boxes allow you to specify what particular information
about a security you would like to fetch. By default EViews will fetch the field
“PX_LAST” without any overrides.
For example, we can simply type “us gdp” into the Search Text box and press OK.
You should return to the database window with the following search results displayed:
Any series displayed in the database may be manipulated following the usual EViews
interface conventions:
• Double click on a series to bring up detailed information on the series
• Drag and drop series or copy and paste them into an EViews workfile or database
to fetch the current data from the server (drag with the right mouse button or use Paste
Special to create links)
Limitations
Note that the highest resolution of data that can be fetched by EViews is one minute
interval data. EViews does not currently support reading tick data for a security.
Further, the Bloomberg database extension for EViews that powers the connection
only supports Bloomberg Desktop API configurations (Bloomberg Server API and B-
Pipe configurations are not supported).
CEIC
The CEIC database includes economic, sector and financial data. Data are fetched
from the internet by Internet Securities, Inc. (also known as IS Emerging Markets) XML
based data servers.
CEIC database access is only available in the Enterprise Edition of EViews.
To access CEIC data, the CEIC-EViews Interface Software must already be installed
on the client machine. To obtain the software and a valid CEIC account, please contact
Internet Securities, Inc. directly. For additional information, please see
http://www.securities.com.
To access a CEIC database, select File/Open/Database... and select CEIC Database
in the drop-down menu and fill out your User name and Password as prompted. The
Sever specification is pre-filled with the CEIC default, but you may enter the
specification information for a different server if desired:
You may optionally provide a Database alias. Click on OK to open the database in the
standard EViews interface.
Datastream
The Datastream database allows you to fetch data remotely over the internet from
Datastream's extensive collection of financial and economic data. Data are retrieved
from the Thomson Financial Datastream historical XML API. The location of the XML
API must be entered in the server specification of the open database dialog window.
Datastream database access requires the Enterprise Edition of EViews.
In addition, you must be able to access to the Thomson Datafeeds service using
Datastream Advance through an internet connection, and you must have a valid XML
API account from Thomson Financial. (Note that the XML API user name is not the
Datastream user name as used with thick client products such as Datastream
Advance.)
Please contact Thomson Reuters for further information
(http://www.thomsonreuters.com).
DRIPro Link
A DRIPro link is a special type of database which allows you to fetch data remotely
over the internet from DRI’s extensive collection of economic data. To access these
data, you must have a valid DRIPro account with DRI, and you must have already
installed and configured the DRIPro server software.
(Note: the DRIPro Link interface has been replaced by the newer IHS Global Insight
Database Browser; see “IHS Global Insight”.)
There are special issues involved with using DRIPro links, which are discussed in
detail in “Working with DRIPro Links”.
DRIBase Database
The DRIBase system is a client server system used by DRI to provide databases at
the client site which can be kept current by remote updates. Customers can also use
DRIBase as a means of storing their own databases in an Sybase or Microsoft SQL
Server system.
(Note: the DRIBase interface has been replaced by the newer IHS Global Insight
Database Browser; see “IHS Global Insight”.)
DRIBase access is only available in the Enterprise Edition of EViews.
To access DRIBase databases, the TSRT library from DRI must already be installed
on the client machine (this will normally be done by DRI as part of the DRIBase
installation procedure).
When working with DRIBase databases, the Server specification field should be set
to contain the DRIBase database prefix, while the Database name field should contain
the DRIBase bank name, including the leading “@” where appropriate. Note that these
fields, as well as the Username and Password fields may be case sensitive, so make
sure to preserve the case of any information given to you.
A DRIBase database has slightly different handling of frequencies than most other
databases supported by EViews. See “Issues with DRI Frequencies” for details. You
should also read “Dealing with Illegal Names” for a discussion of how DRI names are
automatically remapped by EViews.
For further information on DRIBase, please contact IHS Global Insight
(http://www.globalinsight.com).
EcoWin
EcoWin database support provides online access to economic and financial market
data from EcoWin. The EcoWin Economic and Financial databases contain global
international macroeconomic and financial data from more than 100 countries and
multinational aggregates. Additional databases provide access to equities information
and detailed country-specific information on earnings estimates, equities, funds, fixed
income, and macroeconomics. For further information on EcoWin data and software,
please contact EcoWin directly
(http://www.thomsonreuters.com/products_services/financial/financial_products/inve
stment_management/research_analysis/ecowin_pro).
EcoWin database access is only available in the Enterprise Edition of EViews.
With EViews Enterprise Edition, you can open an EViews window into an online
EcoWin database. This window allows browsing and text search of the series in the
database, selecting series, and copying/exporting series into an EViews workfile or
another EViews database. In addition, EViews provides a set of commands that may
be used to perform tasks such as fetching a particular series from a EcoWin database.
Access to EcoWin databases within EViews Enterprise Edition requires that the
EcoWin Pro software has already been installed on the local machine, and that
configuration of EcoWin database access using the EcoWin Database Configuration
software has already been completed outside of EViews.
Interactive Graphical Interface
To open a graphical window to an EcoWin database, you should first open Database
Specification dialog by selecting File/Open/Database… from the main EViews menu.
Next, choose EcoWin Database in the Database/File Type dropdown, and enter the
name of the online database as specified in the EcoWin Database Configuration
software, typically “DEFAULT”.
Clicking on OK will open an empty EViews database window. To access the EcoWin
data, click on the Query–Select button in the database window toolbar. EViews will
open a window containing a EcoWin Pro control for browsing and searching the online
data. Note that it may take a bit of time to initialize the EcoWin control. Once initialized,
EViews will open the EcoWin Query window.
The EcoWin Query window provides you with two methods for selecting series to be
brought into your EViews database.
First, you may use Tree Search to browse a directory structure of the online database.
You should use the tree on the left to navigate to the directory of interest, then select
series in the window on the right by clicking or control-clicking on the entry, or by
clicking on the right-mouse button and choosing Select All. Once the desired series
have been highlighted, click on OK to bring the selected data into your EViews
database.
This procedure, first browsing to find a directory containing data of interest, selecting
series, and then clicking on OK to bring in data, can be performed multiple times, until
a list of all the series that you wish to use has been accumulated within the EViews
database window. At this point the EcoWin browse control can be closed using the
Cancel button.
In place of browsing the tree structure of the database, you may elect to use text
search to display a list of series in the database. Click on the Text Search selection at
the top of the dialog to change the dialog to the search display, and enter the
information in the appropriate fields. For example, to search for all series in the
database using the text “PETROLEUM” and “US”, we have:
Highlight the series of interest and click on OK to bring them into the database. Repeat
the tree browsing or search method of adding series until the list in the database is
complete, then click on Cancel to close the query window.
Once series of interest have been included in the database window, all of the standard
EViews database tools, such as copy and paste into an existing workfile or database
using the right mouse menus, creating a new EViews workfile containing the data
using the Export button, or importing data into an existing EViews workfile using the
Fetch menu item from the workfile window, are available.
Note that after you have completed your initial query, you may reopen the EcoWin
query window at any time. To add series to those already available in the database
window, press the Query Append Select button in the database window, then browse
or search for your series. To first clear the contents of the database window, you
should press the Query Select button instead of the Query Append Select button.
Tips for Working with EcoWin Databases
If an EcoWin database is going to be used frequently or for direct access to individual
series, you should find it useful to add an EcoWin entry in the database registry (“The
Database Registry”).
The EViews database registry may be accessed by choosing Options/Database
Registry... from the main EViews menu. Press Add New Entry to add a new database
registry entry to the list. The procedure for adding an EcoWin database to the registry
is identical to that for opening an EcoWin database. The Database/File Type field
should be set to EcoWin Database and the Database Name/Path field should be filled
with the name assigned to the database in the EcoWin Database Configuration
software (generally “DEFAULT”).
Once the EcoWin database has been put in the registry, it may be referred to by its
alias (short hand) name. For example, if you have assigned the EcoWin database the
alias “EW”, you can open the database with the simple command:
dbopen ew
or by using the Browse Registry button in the Database Specification dialog. The
database name “EW” will be added to the most recently used file list, where it may be
selected at a later time to reopen the database.
Assigning the EcoWin database a shorthand name also allows you to reference data
without explicitly opening the database. For example, the command
equation eq1.ls ew::usa09016 c ew:usa09016(-1) @trend
runs a regression of U.S. unemployment on an intercept, its own lagged value, and a
time trend. The series USA09016 will be accessed directly from the EcoWin servers,
and does not need to appear within a currently open database window for this
command to be used. Other commands such as copy allow the name associated with
the series to be changed during the procedure, as well as supporting the copying of
series directly from an EcoWin database to another EViews database.
show ew::usa09016
displays a table of U. S. unemployment.
Note that series in the EcoWin “Economic” or EcoWin “Financial” databases may be
referenced merely by using the database shorthand and the series name. In the
example above, EViews looks for USA09016 in the two base EcoWin databases.
Series located in add-on EcoWin databases such as “Bank of England,”
“Bundesbank,” “Bureau of Economic Analysis,” must also provide the name of the add-
on database in which the series is located. You should provide the name of the EcoWin
shortcut followed by a double colon, an EcoWin add-on database prefix, a slash, and
then the series name. For example, you can fetch the mortgage rate (LUM5WTL) in
the Bank of England database with
fetch ew::boe\lum5wtl
where we follow the database name with the add-on name BOE. The series will be
named “BOE\LUM5WTL” in EViews. Note that the add-on name BOE is taken from
the EcoWin name prefix (for example, LUM5WTL appears as “BOE:LUM5WTL” within
EcoWin.
EIA (U.S. Energy Information Administration)
The EIA database is a large collection of free and publicly available energy and related
economic data provided by the U.S. Energy Information Administration.
EViews Enterprise Edition supports both online access to EIA data via the EIA web
server as well as offline access to data downloaded in the EIA Bulk File format.
Online EIA Database
To open the EIA online database, simply select File/Open Database… from the main
EViews menu, then select EIA Online Database from the Database/File type
dropdown menu:
The server specification will be automatically filled in with the EIA server address
api.eia.gov which you should not need to change. The database will always be opened
with the name “eia”. Click on OK to proceed.
Use of the EIA online service is free but requires registration. The first time you attempt
to open the EIA online database you will be asked to enter an API Key obtained from
the EIA:
Please enter your API key then click on OK. The key will be saved as a user specific
setting in your EViews “.ini” file. If you need to change the key at a later time, use
View/Preferences… from the EViews database menus to bring up the dialog again so
you can modify your settings.
When you click on OK, EViews will open a standard database window:
The EIA database connection supports a custom browser window for navigating
through the EIA data. Click on Browse to open the custom browser window. The
standard database window will be minimized and the EIA browser window will open:
The browser window displays the data available within the database as a set of folders,
where each folder may contain additional folders or a list of series available for
downloading. Clicking on a folder moves you into that folder and adds the folder to the
path displayed at the top of the window:
You can return to the previous folder by clicking on the “..” folder icon at the top of the
list. You can also move directly to any folder within the current path by clicking on the
path component at the top of the window.
Any series contained in the folder may be manipulated in the usual fashion. When you
have finished working with the browser, simply close the browser window to restore
the regular EViews database window.
Offline EIA Databases
EViews also allows you to work offline with data downloaded from the EIA using the
EIA bulk download facility. The bulk download feature allows you to fetch all series
and category information from an entire EIA data set into a single local file.
Downloading an entire bulk file is generally much more efficient than fetching a large
number of series one at a time. Once the file has been downloaded, you can navigate
within the dataset and bring data into EViews without reconnecting to the EIA servers.
To download a bulk file, open the browser window of the EIA online database, right
click on a data set, then select Download Bulk File…:
A dialog will appear giving instructions for downloading the file and preparing it for use
by EViews:
Clicking on the download link will open your default web browser and start a download
of the file. The bulk file is compressed in “.zip” format. You will need to use an
unzipping utility to extract the single “.txt” file contained within the zip file. Finally,
rename the “.txt” file to “.eia” so EViews can tell that the file contains data in EIA bulk
file format rather than a generic text file.
Once the bulk file has been prepared, use File/Open Database… and browse to the
file or simply drag and drop the file onto EViews to open it. The caption on the window
indicates that you are working with a local file. Otherwise, the interface behaves the
same as when working with online data:
Note that some EIA data sets are large (hundreds of megabytes of uncompressed
data). When working with large files you may see a delay as the file is opened since
EViews must completely scan the entire bulk file to find all series and category
information stored in the file. Subsequent operations should be fast since all data is
stored locally on the machine.
Eurostat, ECB, and UN
SDMX Databases provide access to a list of datasets that offer a large range of
publicly available data.
Both the Standard and Enterprise versions of EViews offer access to Eurostat, ECB
(European Central Bank), and UN (United Nations) data using SDMX Web Services.
Please note that an internet connection will be required to obtain SDMX online data.
For more information on the datasets, please see
http://ec.europa.eu/eurostat/data/database
https://ec.sdw-wsrest.ecb.europa.eu
http://data.un.org/WS/
EViews offers a custom interface to the SDMX databases. The interface includes a
custom browser for navigating and retrieval of available data. To start, you must open
a database window to SDMX database by selecting File/Open Database… from the
main EViews menus, then selecting Eurostat SDMX Database, or ECB SDMX
Database, or UN SDMX Database from the Database/File type dropdown menu. A
dialog of the following form will be displayed:
Click on OK to open the online database. You will be presented with a standard
EViews database representing a connection to data. Click on Browse or Browse-
Append to open a custom database.
Here we see the interface to the Eurostat data:
The browser allows you to find data available within datasets by navigating through a
set of folders. Click on any folder to move inside it. A dialog with a list of filters will be
shown, which will allow you to filter and customize the search results of the available
series objects in the selected dataset.
Click on Get to show the results.
The full path of the active folder will be shown in the header at the top of the window.
You can click on any folder within the path to navigate back to that folder. Similarly,
clicking on the ".." in the window listing will move up a single level.
The browser interface to the data offers a number of useful tools for working with your
Eurostat database:
• The Search button allows searching the browse window by keyword. Simply enter
a keyword into the edit box and click the Search button. EViews will highlight a list of
data sets or series that match the keyword.
• Right-clicking on items in the browser will bring up a menu for performing useful
tasks:
1. Open can be used to navigate inside a folder or bring a series object in the database
window.
Once you have found the series of interest, you may drag-and-drop (or copy-and-
paste) the series directly into an EViews workfile in the usual fashion.
FactSet
The FactSet database is a remote database provided by FactSet Research Systems.
It is composed of more than 800 commercial data sets of financial data. Data include
international macroeconomic, commodity, and financial time series from more than
150 countries.
Use of FactSet databases requires the Enterprise Edition of EViews and installation
of FactSet client software. For further information on using Factset please contact
Factset directly (http://www.factset.com).
FAME
The FAME format is a binary file format written by FAME (SunGard MarketMap
Analytic Platform) database products. FAME provides a variety of products and
services for working with time series data.
FAME access is only available in the Enterprise Edition of EViews.
In order to access FAME databases, a valid installation of FAME must already be
available. EViews makes use of the FAME C Host Language Interface (C HLI) library,
and will error unless the FAME .DLLs are correctly installed on the machine. EViews
supports versions 8 and newer of the FAME libraries.
A local FAME database can have any file extension, and EViews supports access to
a FAME database with any name. However, because many commands in EViews use
the file extension to automatically detect the file type, you will generally find it easier
to work with FAME databases which have the default “.DB” extension.
EViews also allows access to FAME databases located on a FAME Database Server.
When working with a FAME server, the Server specification should be given in the
form:
#port_number@ip_address
For example, the server specification for access to a FAME/Channel database might
appear as:
#[email protected]
Access to a server will require a valid username and password for that server.
Please contact SunGard directly (http://www.sungard.com/fame) for further
information about the FAME database system and other FAME products.
FRED
FRED (Federal Reserve Economic Data) is a publicly accessible database of more
than 20,000 U.S. and international time series of multiple frequencies, provided by the
Economic Research Division of the Federal Reserve Bank of St. Louis. The FRED
database offers a wide variety of freely downloadable data, including interest rates,
exchange rates, national income accounts, and many others. Data found in FRED are
drawn from several national and international sources and is updated frequently.
For more information on the FRED database, please see
http://research.stlouisfed.org/fred2.
Both the Standard and Enterprise versions of EViews offer FRED access. Please note
that an internet connection will be required to obtain FRED data.
EViews offers a custom interface to the FRED data service provided by the Federal
Reserve Bank of St Louis. The interface includes a custom browser for navigating the
available FREDX data and adds support for retrieval of historical releases. To access
the FRED database, use File/Open Database… from the main EViews menus and
choose “FRED Database”:
Click on OK to open the online database. You will be presented with a standard
EViews database window with the Query and Easy Query search interface. Click on
Browse or Browse–Append, which will open an all new custom FRED database. Click
on the folder icons to drill down into subtopics:
The browser allows you to find data available within FRED by navigating through a set
of nested folders. Simply click on any folder to move inside it.
The full path of the active folder will be shown in the header at the top of the window.
You can click on any folder within the path to navigate back to that folder. Here, clicking
on Categories will move back up a single level to show the category choices. Similarly,
clicking on the “..” in the window listing will move up a single level.
Once you have found the series of interest, you may drag-and-drop (or copy-and-
paste) the series directly into an EViews workfile in the usual fashion.
The browser interface to FRED offers a number of useful tools for working with your
FREDX database:
• Clicking on the All Series Search folder in the FRED root directory changes the
interface to allow searching by keyword. Simply enter one or more keywords into the
Search For box and EViews will display a list of series that match those keywords.
• You can use the Order By combo to change the order in which series are listed. By
default, EViews will show the Most Popular items first, but you can order by
alphabetical Description order, Recently Updated, Earliest Values, Latest Values,
Highest Frequency, and Lowest Frequency.
• You may click on the Add Filter button to narrow the display list. Filters will be
displayed at the top of the window and may be modified, disabled, or removed by
clicking on the filter description in the header.
• You may use the As Of dropdown calendar to restrict the data to a particular vintage,
which is handy when trying to match a particular data revision.
• Right-clicking on items in the browser will bring up a menu with items for performing
useful tasks:
1. Jump to Category can be used to navigate directly to the folder within the category
tree that contains the selected series. If the series appears in more than one category,
a list will appear for you to choose which of the folders you would like to navigate to.
2. Jump to Release can be used to navigate directly to the statistical release that
contains the selected series.
3. Filter by tags allows you to see the list of tags attached to a particular series. Tags
are standardized concepts that may be used to filter which series are displayed within
the browser window. You may check or uncheck the tags of a series to adjust the
filtering currently in effect:
4. The Show Release Dates menu item displays a list of release dates for the selected
series. You may use this information in conjunction with the As Of dropdown to retrieve
the historical version of a series.
5. The Copy As Of right mouse button menu item allows you to retrieve multiple
historical revisions at once. Simply select one or more series in the browser window,
then click on Copy As Of to see a list of available releases. Select the releases you
would like to copy by clicking on them then click on the Copy Selected Releases button
at the bottom of the screen.
GiveWin/PcGive
The GiveWin/PcGive format is a binary file format used by GiveWin, PcGive versions
7 through 10, and PcFiml.
There are two issues when working with GiveWin/PcGive files. The first is that EViews
is case insensitive when working with object names, while GiveWin and PcGive are
case sensitive. Because of this, if you intend to work with a file in both packages, you
should avoid having two objects with names distinguished only by case. If your files
do not follow this rule, EViews will only be able to read the last of the objects with the
same name. Any early objects will be invisible.
The second issue concerns files with mixed frequency. The GiveWin/PcGive file
format does support series of mixed frequency, and EViews will write to these files
accordingly. However, GiveWin itself appears to only allow you to read series from
one frequency at a time, and will ignore (with error messages) any series which do not
conform to the chosen frequency. Consequently, depending on your application, you
may prefer to store series of only one frequency per GiveWin/PcGive file.
Haver
The Haver database format is a binary file format used by Haver Analytics when
distributing data.
Direct access to Haver database files is only available in the Enterprise Edition of
EViews.
The main difference between Haver databases and other file formats supported by
EViews is that Haver databases are read-only. You cannot create your own database
in Haver format, nor can you modify an existing database. EViews will error if you try
to do so.
Please contact Haver Analytics (http://www.haver.com) directly for further information
about Haver Analytics data products.
IHS Global Insight
The IHS Global Insight Database is a large and frequently updated international data
offering for over 200 global markets. The Global Insight Database offers a modern
interface for accessing the same data offered through the IHS Magellan interface.
To access the Global Insight Database you must have a valid IHS MyInsight username
and password, which can be requested from the IHS webpage
(http://www.ihs.com/products/global-insight/data-analytics/index.aspx).
Note that access is only available in the Enterprise Edition of EViews.
To open a connection to the IHS Global Insight Database, select File/Open
Database… from the main EViews menu, then select IHS Global Insight Database
from the Database/File type dropdown menu:
EViews will launch the Global Insight Database Browser, allowing you to search the
database of series available from IHS:
For more information see the PDF guide to using the IHS Global Insight Database
Browser from within EViews, available from our website:
www.eviews.com/download/download.html.
IHS Magellan
You may use EViews to access IHS Global Insight data stored in Magellan data banks
Please note that an internet connection and a MyInsight account will be required to
obtain IHS Magellan data.
(Note: the IHS Magellan interface has largely been replaced by the newer IHS Global
Insight Database Browser; see “IHS Global Insight”.)
Bank Names
There are two ways of specifying a particular Magellan series in an EViews command:
• using series type (e.g. “gdp.q.hist”)
Both of these identifiers will work no matter what bank name was specified when
opening the database.
The bank name specified when opening a database only affects what happens when
you use an incomplete series identifier (containing neither a series type nor a bank
name).
When you specify a particular bankname when opening a database, this bankname is
used as the default bankname for all operations in the database. This means that
whenever you specify a series name without a leading bankname, this default
bankname will be added to the front of the name. So, if you open a database with bank
“US”:
• “fetch gdp.q” will be interpreted as “fetch us\gdp.q”.
• doing an easy query for “name matches gdp*” will be interpreted as an easy query
for “name matches us\gdp*”.
When you specify the special “all banks” keyword when opening a database (“IGI”)
then there is no default bank. In this case a bank name is never added to any series
names, but the series type “.hist” will be added whenever a series type is required but
has not been specified in a name. So
• “fetch gdp.q” will be interpreted as “fetch gdp.q.hist”.
Note that in either case, you can always override the bankname specified during
database open in Easy Query by adding an explicit “bankname\” to the beginning of
the name. Thus, name matches “us\*” and description matches “iron steel” will
produce the same results no matter the default bankname.
Special Handling of Mnemonics
EViews recognizes mnemonics in IHS Magellan databases that have illegal EViews
characters (“@,” “&,” etc.) and will, if possible, prompt to rename the series before
transferring it to your active workfile. The default replacement for illegal characters is
an underscore. If you are using a command to fetch data, EViews will automatically
replace an illegal character with an underscore.
Note that EViews drops the frequency identifier when a series is pulled into the workfile
if the frequency of the series fetched matches the workfile frequency. If the original
series does not match the workfile frequency, EViews will note this fact and convert
the series to the workfile page frequency using the series defaults and prompt you for
a name change.
For example, if you fetch the Magellan series GDP.Q into an annual frequency page
of a workfile, EViews will convert the data in GDP.Q to an annual frequency (i.e.,
averaging the four quarters, if average is the default for high to low frequency) and it
will prompt for a series name since “GDP.Q” is not a legal EViews name. The prompt
will suggest the name “GDP_Q,” but you will have the option to provide different name.
If instead you fetch GDP.A into the annual-frequency workfile, EViews will
automatically drop the “.A,” leaving the series GDP in the workfile.
(Note that while this method of fetching data will provide you with a quarterly series
from one that is reported at a monthly frequency, an better approach might be to bring
the monthly series into a monthly page, then link the data into a quarterly page.)
Special Handling of Frequencies
There are two rules to make handling of Magellan (and AREMOS) frequencies easier
in EViews:
1. When fetching into a workfile, if the Magellan series identifier does not contain an
explicit version/frequency, EViews will add a version/frequency based on the
frequency of the destination workfile.
Examples:
• “fetch gdp” into a quarterly workfile will try to fetch “gdp.q” (using rule 1) and then
discard the version “.q” from the name (using rule 2) so that the series appears in the
workfile as “gdp.”
• “fetch gdp.q” into a quarterly workfile will also discard the version “.q” from the name
(using rule 2) so that the series appears as “gdp.”
• “fetch gdp.m” into a quarterly workfile will not match either rule, so the series will
keep the illegal name “gdp.m” which EViews will suggest renaming to “gdp_m.”
• copying a series from a Magellan database into an EViews database will never use
either rule (because EViews databases do not have a default frequency).
5. In the left tree-view, expand the node “.NET Framework 2.0 Configuration/My
Computer/Runtime Security Policy/Machine/Code Groups/All_Code.”
6. Under “All_Code,” right-click “LocalIntranet_Zone,” then click on New.
7. Enter a name and description (e.g. “EViews Network Share”). Click Next.
8. In the “Choose the condition type for this code group” list, click “URL.”
9. In the “URL” box, type in the full path to your EViews network file share followed
by an asterisk to allow any extensions in that folder to run with the new permissions
(e.g. “\\servername\folder\EViews 9\*”). Click Next.
10. Select “Use existing permission set” and then select “FullTrust” from the dropdown
list. Click Next.
12. Restart EViews from the network folder to obtain the new permissions. Try
opening a database using the IHS Magellan database extension to verify it loads
properly.
You will have to repeat this procedure on each computer that will run EViews in order
to get the IHS Magellan database extension working properly from the network.
Moody’s Economy.com
The Moody's Economy.com format is a binary file format written by Moody's
Economy.com tools. Moody s Economy.com features a database containing more
than 190 million economic, financial, and demographic time series covering more than
180 countries and their sub-regions.
The Enterprise Edition of EViews is required to read Moody’s Economy.com formatted
data.
Additional information on Moody's Economy.com databases can be found at
http://www.economy.com.
RATS 4.x
The RATS 4.x format is a binary file format used by RATS Version 4 through 7 on all
platforms.
The main issue to be aware of when working with RATS 4.x format files is that the
“.RAT” extension is also used by RATS version 3 files. EViews will neither read from
nor write to RATS files in this earlier format. If you try to use EViews to open one of
these files, EViews will error, giving you a message that the file has a version number
which is not supported.
To work with a RATS Version 3 file in EViews, you will first have to use RATS to
translate the file to the Version 4 format. To convert a Version 3 file to a Version 4 file,
simply load the file into RATS and modify it in some way. When you save the file,
RATS will ask you whether you would like to translate the file into the new format. One
simple way to modify the file without actually changing the data is to rename a series
in the file to the name which it already has. For example, if we have a Version 3 file
called “OLDFILE.RAT”, we can convert to a Version 4 by first opening the file for
editing in RATS:
dedit oldfile.rat
then listing the series contained in the file:
catalog
then renaming one of the series (say “X”) to its existing name
rename x x
and finally saving the file
save
At this point, you will be prompted whether you would like to translate the file into the
Version 4 format.
See the RATS documentation for details.
RATS Portable
The RATS portable format is an ASCII file format which can be read and written by
RATS. It is generally slower to work with than RATS native format, but the files are
human readable and can be modified using a text editor.
You can read the contents of a RATS portable file into memory in RATS with the
following commands:
open data filename.trl
data(format=portable) start end list_of_series
close data
To write what is currently in memory in RATS to a RATS portable file, use:
open copy filename.trl
copy(format=portable) start end list_of_series
close copy
See the RATS documentation for details.
SDMX-ML Files
SDMX (Statistical Data and Metadata eXchange) standardizes the processes for the
exchange of statistical data among international organizations. EViews offers an
interface to SDMX data where the user has the ability to read SDMX datasets and
data structure definitions (DSD) in structured XML documents (SDMX-ML), using the
standard EViews database interface. EViews allows you to work offline with data from
organizations like EUROSTATA, ECB, IMF, UN, BIS, and OECD. Both the Standard
and Enterprise versions of EViews offer reading of SDMX data. Please note that the
EViews SDMX-ML interface requires that data were previously downloaded in SDMX
XML format.
To start, you must open a database window to SDMX-ML by selecting File/Open
Database… from the main EViews menus, then selecting SDMX-ML files from the
Database/File type dropdown menu. The following dialog should appear:
Click on Browse Path to select the folder/path on disk where the SDMX data and data
definitions files are located.
Click on OK to open the database. You will be presented with a standard EViews
database with the All, Query and Easy Query search interface, to view all or a selection
of the data series:
Once you have found the series of interest, you may drag-and-drop (or copy-and-
paste) the series directly into an EViews workfile in the usual fashion.
TSP Portable
The TSP portable format is an ASCII file format which can be read and written by
copies of TSP on all platforms. The file consists of a translation of a TSP native
databank (which typically have the extension “.TLB”) into a TSP program which, when
executed, will regenerate the databank on the new machine.
To create a TSP portable file from a TSP databank file, use the DBCOPY command
from within TSP:
dbcopy databank_name
To translate a TSP portable file back into a TSP databank file, simply execute the TSP
file as a TSP program.
Once the data are in TSP databank format, you can use the TSP command,
in databank_name
to set the automatic search to use this databank and the TSP command,
out databank_name
to save any series which are created or modified back to the databank.
See the TSP documentation for details.
World Bank Data
EViews 10 offers a new custom interface to World Bank data. World Bank Open Data
provides access to a list of datasets that offer access to global development data.
These databases offer a wide variety of freely downloadable indicators about
development in countries around the world.
For more information on the World Bank datasets, please see
http://data.worldbank.org.
Both the Standard and Enterprise versions of EViews offer World Bank access. Please
note that an internet connection will be required to obtain World Bank data.
EViews offers a custom interface to the World Bank. The interface includes a browser
for navigating and retrieval of World Bank data. To start, you will open a database
window by selecting File/Open Database… from the main EViews menus, then
selecting World Bank Database from the Database/File type dropdown menu. The
following dialog should appear:
Click on OK to open the online database. You will be presented with a standard
EViews database window.
The full path of the active folder will be shown in the header at the top of the window.
You can click on any folder within the path to navigate back to that folder. Here, clicking
on Countries will move back up a single level to show the country choices. Similarly,
clicking on the ".." in the window listing will move up a single level.
The browser interface to the World Bank offers a number of useful tools for working
with your World Bank database:
• The Search button allows searching by keyword. Simply enter a keyword into the
edit box and click the Search button. EViews will display a list of indicators that match
the keyword.
• You can use the < and > buttons to navigate to the next and the previous indicator
pages.
• You can use the |< and >| buttons to navigate to the first or last indicator pages.
• Right-clicking on items in the browser will bring up a menu with items for performing
useful tasks:
1. Open can be used to navigate inside a folder or bring an indicator in the database
window.
Once you have found the series of interest, you may drag-and-drop (or copy-and-
paste) the series directly into an EViews workfile in the usual fashion.
Working with DRIPro Links
EViews has the ability to remotely access databases hosted by DRI. Subscribers to
DRI DRIPro data services can use these features to access data directly from within
EViews.
Although the interface to remote databases is very similar to that of local databases,
there are some differences due to the nature of the connection. There are also some
issues specifically related to accessing DRI data. The following sections docOnce you
have found the series of interest, you may drag-and-drop (or copy-and-paste) the
series directly into an EViews workfile in the usual fashion.
ument these differences.
Enabling DRI Access
In order to access DRI data services, you will need to have an active DRIPro account.
If you are not an existing DRIPro customer but may be interested in becoming one,
you should contact Global Insight for details (http://www.globalinsight.com).
Access to DRI data will not be possible unless you have already installed and
configured the DRIPro server software. If you have difficulties with getting the software
to work, you should contact Global Insight directly for technical support.
Creating a Database Link
A remote DRI database is represented in EViews by a database link. A database link
resembles a local database, consisting of a set of files on disk, but instead of
containing the data itself, a database link contains information as to how to access the
remote data. A database link also contains a cache in which copies of recently
retrieved objects are kept, which can substantially reduce the time taken to perform
some database operations.
You can create a database link by following a similar procedure to that used to create
a local database. Select File/New/Database… from the main menu, then select
DRIPro Link in the field Database/File Type. The dialog should change appearance
so that a number of extra fields are displayed. Enter the name you would like to give
the new database link in Cache name/path. You may wish to name the database link
after the DRI databank to which it links.
In the Connection name field you should enter the name of the DRIPro connection you
would like to use, as it appears in the Connection Settings box in the DRIPro
configuration program. If you have only configured a single connection, and have not
modified the connection name, the connection name will be DEFAULT, and this will
be filled in automatically by EViews if you leave the field blank.
In the DRI Databank field you should input the full name of the DRIPro bank to which
you would like to connect, not including any leading “@” sign. For example, to connect
to the DRI U.S. Central database, you should enter the name uscen. Each EViews
database link may be associated with only one DRI databank, although you can create
as many database links as you require.
The Local Password field may be used to set a password that must be entered
whenever you wish to use the database link. This should not be confused with your
DRIPro username and password, which you must already have provided in the DRIPro
configuration program. Accessing a database link which contains a local password will
cause a dialog to appear which prompts the user to input the password. Access to the
remote database is only provided if the remote password is valid. Leave this field blank
if you do not want a password to be attached to the database link.
When you have finished filling in the dialog fields, click on the OK button. A new
database will be created and a database window should appear on the screen.
The database link window is very similar to a normal EViews database window. You
should be able to perform basic query operations and simple fetching of series without
any special instructions. Note, however, that it is not possible to modify a remote DRI
database from within EViews, so operations which involve writing to the database
have been removed. There are a number of other complications related to dealing with
DRIPro databases that are described “Issues with DRI Frequencies”.
Understanding the Cache
A database link includes a cache of recently fetched objects which is used to speed
up certain operations on the database. In some circumstances, fetching an object from
the database will simply retrieve a copy from the local cache, rather than fetching a
fresh copy of the data from the remote site. Even if a fresh copy is retrieved, having a
previous copy of the series in the cache can substantially speed up retrieval.
You can regulate the caching behavior of the database link in a number of different
ways. The basic option which determines under what circumstances a new copy of
the data should be fetched is the days before refresh. If you attempt to fetch an object
from the database link, and the copy of the object currently in the cache was fetched
more recently than the days before refresh value, then the object currently in the cache
will be returned instead of a fresh copy being fetched. For example, if days before
refresh is set to one, any object which has already been fetched today will be retrieved
from the cache, while any object which has not yet been fetched today will be retrieved
from the remote site. Similarly, if days before refresh is set to seven, then an object in
the cache must be more than a week old before a new copy of the object will be
fetched. If days before refresh is set to zero, then a new copy of the data is fetched
every time it is used.
You can change the days before refresh setting by clicking on the Proc button at the
top of the database link window, then choosing Link Options… from the pop-up menu.
A dialog will appear:
The dialog contains a number of fields, one of which is labeled Days before refreshing
objects. Type a new number in the field to change the value.
The same dialog also contains a button marked Reset cache now. This button can be
used to modify the behavior documented above. Clicking on the button causes the
cache to mark all objects in the cache as out of date, so that the next time each object
is fetched, it is guaranteed that a fresh copy will be retrieved. This provides a simple
way for you to be certain that the database link will not return any data fetched before
a particular time.
The dialog also contains some options for managing the size of the cache. The field
marked Maximum cache size in kilobytes can be used to set the maximum size that
the cache will be allowed to grow to on disk. If the cache grows above this size, a
prompt will appear warning you that the cache has exceeded the limit and asking if
you would like to compact the cache. Compacting is performed by deleting objects
from oldest to newest until the cache size is reduced to less than three quarters of its
maximum size. The cache is then packed to reclaim the empty space.
You can also completely clear the contents of the cache at any time by clicking on the
button marked Reset & Clear Cache Now.
You can always examine the current contents of the database cache by clicking on
the Cache button at the top of the database link window. This will display the names
of all objects currently in the cache.
Configuring Link Options
The Database Link Options dialog also allows you to specify a number of timeout
values. In most cases, the default values will behave acceptably. If you believe you
are having problems with EViews aborting the connection too early, or you would like
to shorten the times so as to receive a timeout message sooner, then enter new values
in the appropriate fields.
• Connection timeout—is the length of time, in seconds, that EViews will wait for a
response when first connecting to DRI. Depending on the type of connection you are
making to DRI, this can take a significant amount of time.
• Conversation timeout—is the length of time, in seconds, that EViews will wait for a
response from DRIPro when carrying out a transaction after a connection has already
been made.
The values are attached to a particular database link, and can be reset at any time.
Dealing with Illegal Names
DRI databanks contain a number of series with names which are not legal names for
EViews objects. In particular, DRI names frequently contain the symbols “@”, “&” and
“%”, none of which are legal characters in EViews object names. We have provided a
number of features to allow you to work with these series within EViews.
Because the “@” symbol is so common in DRI names, while the underline symbol
(which is a legal character in EViews) is unused, we have hard-coded the rule that all
underlines in EViews are mapped into “@” symbols in DRI names when performing
operations on an DRI database link. For example, if there is a series with the name
JQIMET@UK, you should refer to this series inside EViews as JQIMET_UK. Note that
when performing queries, EViews will automatically replace the “@” symbol by an
underline in the object name before displaying the query results on the screen.
Consequently, if you are fetching data by copying-and-pasting objects from a query
window, you do not need to be aware of this translation.
For other illegal names, you should use the object aliasing features (see “Object
Aliases and Illegal Names”) to map the names into legal EViews object names.
Issues with DRI Frequencies
DRI databases have a different structure than EViews databases. An EViews
database can contain series with mixed frequencies. A DRI database can contain data
of only a single frequency. In order that similar data may be grouped together, each
DRI databank is actually composed of a series of separate databases, one for each
frequency. When working with DRI data from within DRIPro software, you will often
have to specify at exactly which frequency a particular series can be found. In some
cases, a DRI databank may contain a series with the same name stored at several
different frequencies.
Because this approach is inconsistent with the way that EViews works, we have tried
to create a simpler interface to DRI data where you do not need to keep track of the
frequency of each series that you would like to fetch. Instead, you can simply fetch a
series by name or by selecting it from the query window, and EViews will do whatever
is necessary to find out the frequency for you.
An ambiguity can arise in doing this, where a series with the same name appears at
a variety of different frequencies in the DRI databank. By default, EViews resolves this
ambiguity by always fetching the highest frequency data available. EViews will then
perform necessary frequency conversions using the standard rules for frequency
conversion in EViews (see “Frequency Conversion”).
In many cases, this procedure will exactly replicate the results that would be obtained
if the lower frequency data was fetched directly from DRIPro. In some cases (typically
when the series in question is some sort of ratio or other expression of one or more
series), the figures may not match up exactly. In this case, if you know that the DRI
data exists at multiple frequencies and you are familiar with DRI frequency naming
conventions, you can explicitly fetch a series from a DRI database at a particular
frequency by using a modified form of the command line form of fetch. Simply add the
DRI frequency in parentheses after the name of the series. For example, the
command:
fetch x(Q) y(A)
will fetch the series X and Y from the current default database, reading the quarterly
frequency copy of X and the annual frequency copy of Y. If you request a frequency
at which the data are not available, you will receive an error message. You should
consult DRI documentation for details on DRI frequencies.
Limitations of DRI Queries
Queries to DRI database links are more limited than those available for EViews
databases. The following section documents the restrictions.
First, queries on DRI databases allow only a subset of the fields available in EViews
databases to be selected. The fields supported are: name, type, freq, start, end,
last_update and description.
Second, the only fields which can be used in “where” conditions in a query on a DRIPro
database link are name and description. (EViews does not support queries by
frequency because of the ambiguities arising from DRI frequencies noted above).
Each of these fields has only one operator, the “matches” operator, and operations on
the two fields can only be joined together using the “and” operator.
The “matches” operator is also limited for queries on DRI databases, matching only a
subset of the expressions available for EViews databases. In particular, the pattern
expression in a query on an DRI database must either have the form
a or b or … c
or the form
a and b and … c
Mixing of “and” and “or” is not allowed, and the “not” operator is not supported.
Patterns, however, are allowed and follow the normal EViews rules where “?” denotes
any single character and “*” denotes zero or more characters.
Sorting of results by field is not supported.
Dealing with Common Problems
As stated in the introduction, you must install and configure the DRIPro software
before EViews will be able to connect to DRI. If you cannot connect to DRI using the
DRIPro software, you should contact DRI directly for assistance.
Assuming that you have correctly configured your DRIPro connection, in most cases
EViews will be able to recover adequately from unexpected problems which arise
during a DRIPro session without user intervention. Sometimes this will require EViews
to automatically disconnect then reconnect to DRI.
There are some circumstances in which EViews may have problems making a
connection. In order to connect to DRI, EViews uses a program written by DRI called
DRIprosv. You can tell when this program is running by looking for the icon labeled
“DRIpro server” in the Windows taskbar. Because of problems that can arise with
multiple connections, EViews will not attempt to use the program if it is already
running. Instead, EViews will report an error message “DRI server software already
running”. If there is another application which is using the connection to DRI, you can
simply close down that program and the DRIPro server software should shut down
automatically. If this is not the case, you may have to close down the DRIPro server
software manually. Simply click on the icon in the Windows taskbar with the right
mouse button, then select Close from the pop-up menu.
You may also use this as a procedure for forcing the DRIPro connection to terminate.
Closing down the server software may cause EViews to report an error if it is currently
carrying out a database transaction, but should otherwise be safe. EViews will restart
the server software whenever it is needed.
Note that running other DRIPro software while EViews is using the DRIPro server
software may cause EViews to behave unreliably.