User’s Guide : EViews Fundamentals : Workfile Basics : Creating a Workfile
  
Creating a Workfile
 
Creating a Workfile by Describing its Structure
Describing a Dated Regular Frequency Workfile
Describing an Unstructured Workfile
Describing a Balanced Panel Workfile
Creating a Workfile by Reading from a Foreign Data Source
An Illustration
Opening an Excel file
Opening an ASCII text file
Opening a Stata file
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.
Opening an Excel file
If you have chosen an Excel file, the first dialog that will open is Step 1 of the Excel 97-2003 Read dialog. This page lets you select which data in the Excel file you wish to read into EViews. You can choose from either one of the Predefined range options (a list of Excel ranges that EViews has automatically selected), or you can specify a Custom range, and enter the Sheet name and the Start Cell and End Cell of the data. The bottom half of this dialog presents a preview of the incoming data, based upon the range you have selected. In this example we have opened the file “academic salaries by discipline.XLS”. Here the predefined range chosen by EViews is exactly the data we wish to read.
If you wish to transpose the incoming data, which will arrange the data by row rather than by column, check the Read series by row checkbox at the bottom of the dialog.
If you are happy with the way the previewed data looks, you can click Finish, and EViews will open up a new workfile containing the Excel data. For further adjustments to the data import, you can click Next rather than Finish and open up Step 2 of the Excel 97-2003 Read dialog.
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.