IRIS Toolbox Reference Manual

dbload

Create database by loading CSV file

Syntax

D = dbload(FName, ...)
D = dbload(D,FName, ...)

Input arguments

Output arguments

Options

Description

Use the 'freq=' option whenever there is ambiguity in intepreting the date strings, and IRIS is not able to determine the frequency correctly (see Example).

Structure of CSV database files

The minimalist structure of a CSV database file has a leading row with variables names, a leading column with dates in the basic IRIS format, and individual columns with numeric data:

+---------+---------+---------+--
|         |       Y |       P |
+---------+---------+---------+--
|  2010Q1 |       1 |      10 |
+---------+---------+---------+--
|  2010Q2 |       2 |      20 |
+---------+---------+---------+--
|         |         |         |

You can add a comment row (must be placed before the data part, and start with a label 'Comment' in the first cell) that will also be read in and assigned as comments to the individual tseries objects created in the output database.

+---------+---------+---------+--
|         |       Y |       P |
+---------+---------+---------+--
| Comment |  Output |  Prices |
+---------+---------+---------+--
|  2010Q1 |       1 |      10 |
+---------+---------+---------+--
|  2010Q2 |       2 |      20 |
+---------+---------+---------+--
|         |         |         |

You can use a different label in the first cell to denote a comment row; in that case you need to set the option 'commentRow=' accordingly.

All CSV rows whose names start with a character specified in the option 'userdataField=' (a dot by default) will be added to output tseries objects as fields of their userdata.

+---------+---------+---------+--
|         |       Y |       P |
+---------+---------+---------+--
| Comment |  Output |  Prices |
+---------+---------+---------+--
| .Source |   Stat  |  IMFIFS |
+---------+---------+---------+--
| .Update | 17Feb11 | 01Feb11 |
+---------+---------+---------+--
| .Units  | Bil USD |  2010=1 |
+---------+---------+---------+--
|  2010Q1 |       1 |      10 |
+---------+---------+---------+--
|  2010Q2 |       2 |      20 |
+---------+---------+---------+--
|         |         |         |

Example

Typical example of using the 'freq=' option is a quarterly database with dates represented by the corresponding months, such as a sequence 2000-01-01, 2000-04-01, 2000-07-01, 2000-10-01, etc. In this case, you can use the following options:

d = dbload('filename.csv','dateFormat','YYYY-MM-01','freq',4);