Assigned Data Banks¶
G7 databanks consist of at least two files: an index file that contains a list of series names and a data file. An optional third file, called a stub file, gives code names of the variables and full titles. G7 always has access to one databank, the workspace bank, and often also has access to a second “assigned” bank. The “assigned bank” may be changed during a G7 session by one of the “bank” commands explained below. The “workspace” banks normally are not swapped during a session. (See the Workspace Bank topic.) All data (with an important set of exceptions) introduced into G7 or created during a session will be stored in the workspace (not the assigned bank), no matter how many different banks are assigned during the session. When G7 needs a series, it scans the name list of the workspace and then, only if it doesn’t find the variable there, it scans the name list of the assigned bank. (Preceeding the name of a variable with a letter forces G7 to skip looking in the workspace and to look only in the assigned bank corresponding to that letter.) The assigned bank at position ‘a’ to which G7 has access initially is specified in the G.CFG file in the default directory.
All series created with f commands or introduced with data commands are put into the workspace, even if the (up)date and mupdate commands are used. By design G7 provides no facility for writing directly into an assigned bank. This limitation protects against inadvertently changing a series in a data bank. Building or modifying banks is explained below.
The assigned bank may be one of five types:
- Standard Banks
Exactly the same as the workspace banks. All series begin in the same period, all have the same number of observations, and all data points are represented by 4-byte floating point numbers. The file with the body of the bank has the extension .BNK, while the file with the index has the .IND extension. The number of series is limited to about 65,000, though in practice the maximum number of series will be far less. Simply renaming the files of the workspace after exiting from G7 turns it into a standard bank. The maximum number of observations per series currently is 1,999, but the number may be reduced for efficiency by an appropriate entry in the G.CFG file.
- Compressed Banks
The body of the file has been compressed by recording the starting and ending date of each series and eliminating from each series periods for which no data are available. Where possible, the series is stored as first differences represented by two-byte integers. The body of the bank has the extension .CBK, while the index has the extension .CIN. The number of series is limited by the requirement that the total number of letters in the names of all the variables should be less than 65,000. In practice, that limit is about 7000 series. The Press program converts a bank to a compressed bank. Do not use a compressed bank with dummy variables, of values only 0 or 1, as the 0 observations are treated as missing values.
- Hashed Banks
The body is similar to the Compressed bank, but the index file has been put through a “hashing” process that permits such banks to contain millions of series, so that the number of series is no longer an effective limitation on the size of banks. The body file has the extension .HBK; and the index file, .HIN. The same warning about dummy variables applies. Hashed banks usually require less memory than compressed banks.
- Vam Banks
Vam banks are files that hold vector and matrix data and often are used in the development of Interdyme models. InterDyme is the system of programs and C++ classes used by Inforum to develop macroeconomic interindustry models. The vector data in these files can be read, manipulated, typed, and graphed in G7. If a vector is named “out”, to show the series for sector one, you could refer to it as “out1”. Vam files have the extension .VAM.
- Dirfor Banks
Dirfor files are another format used by Inforum in conjunction with macroeconomic interindustry models. These files hold multiple vectors of data, as well as a set of “macrovariables”. Each Dirfor file needs a companion file in the current directory called DIRFOR.DAT, or it cannot be read. Dirfor files have the extension .DFR. Dirfor files now represent an obsolete format replaced by Vam files.
The five different bank types readily are distinguished by the extension part of their file names. These extensions are as follows:
Type of Bank |
Data File Extension |
Index File Extension |
Standard bank (workspace) |
.BNK |
.IND |
Compressed bank |
.CBK |
.CIN |
Hashed bank |
.HBK |
.HIN |
Vam file |
.VAM |
None |
Dirfor file |
.DFR |
File should be DIRFOR.DAT |
Here are some commonly-used commands for working with banks.
- (ba)nk <bank_name> [<bank_location>]
The command will makes the specified standard, workspace-type G7 databank bank_name the assigned bank.
Example: If a bank consisting of the two files PRICE.BNK and PRICE.IND is in the default directory, the command:
ba price
makes “price” the assigned bank. If the bank is in another directory, use the entire path name in the command; if the path contains spaces or other special characters, wrap the path and filename in quotation marks (”…”). The <bank_location> argument is optional, and may be any letter between ‘a’ and ‘z’ except ‘w’. To assign the price bank in position ‘c’, you would use the command:
ba price c
- cbk <bank_name> [<bank_location>]
Make the specified compressed bank the assigned bank.
- hbk <bank_name> [<bank_location>]
Make the specified hashed bank the assigned bank.
- vam <bank_name> [<bank_location>]
Makes the specified vam file the assigned bank. If a workspace-space type bank (that is, of the .BNK, type) exists, it normally also will be assigned to the same letter.
Thus, if BASE.VAM, BASE.BNK, and BASE.IND all exist, the commands
vam base b
graph b.gnp
will cause G7 to look for gnp first in the vam file, but if it does not find it, G7 also will look in the BASE.BNK bank. If this behavior is not desired, the vammode command can be used; see below for details.
- dfr <bank_name> [<bank_location>]
Makes the specified Dirfor file the assigned bank.
G7 may have up to 25 assigned banks, using the letters ‘a’ through ‘z’ (but not ‘w’), using of any of the five bank types discussed above.
- (lis)tnames [-srgv] <w | a> [wildcard]
Types the names of the variables in the workspace (w) or assigned bank (a), where “a” is any letter between ‘a’ and ‘z’ except ‘w’. If the save command is on, the list will then appear both on the screen and in the saved file. Use of wildcard is optional, and like in DOS, ‘*’ will match any number of characters. For any single character, however, you need to use ‘^’, instead of ‘?’ as in DOS. Option ‘s’ sorts the series in alphabetical order, and ‘r’ reverses the order. If a Vam file is associated with the G bank, then option ‘g’ prints only macro series and option ‘v’ prints only Vam bank series. If the -l option is specified and a root name is provided, then the a set of strings will be defined. The string names will be constructed as the root name followed an integer, and the string definition will be the name of the series. One string will be created for each series in the bank.
- (btit)le <bank_location>
Displays the title and configuration of the workspace (w) or assigned bank (‘a’ through ‘z’ except ‘w’). In the case of the workspace, you can supply a new title or change the existing one. It is useful to record the time and date of creation of data banks. This can be achieved easily by using the keywords “%time” and “%date” in the title. G7 will replace these keywords with the actual time and date, respectively. This capability also can be used elsewhere in G7, including in the vtitle and ic commands.
- close <bank_location> [additional locations]
This command closes the assigned bank at the specified location. If the bank to be closed is a vam file, then this command also will close the associated workspace-type bank, if it is present and open. The command close all will close all open banks.
- vammode <s | a>
Sets the mode for linking vam banks to corresponding macro banks.
For example,
vammode s
makes subsequent vam commands assign only the vam bank. The ‘s’ option is for simple. The other option, ‘a’ for associated, is the default setting, where
vammode a
causes subsequent vam commands to assign an “associated” workspace-type bank if it exists.