Text Files

 

Introduction  Previous page  Next page

 

Text files should generally be structured in a simple format. For example, variables in columns and observations on these in each line (row). Alternatively, one variable per line. SVAR is also able to read variable names and dates from text files, but to do so accurately it requires that names are given on a single line and that dates are written one at a time at the beginning of each line containing observations of the variables, i.e. that each line represents one observation for all variables. An example is the following:

 

date    m     p     y

1980Q1  2.2   3.1   4.1

1980Q2  3.2   2.8   2.1

.      .     .     .

.      .     .     .

.      .     .     .

2003Q4  5.2   7.4  12.1

 

In this case, SVAR realizes that date is not a variable name and that 1980Q2, etc., represents dates. SVAR understands a variety of date names, e.g. 1980:2, 1980(2), 1970M1, 1980Y, 1980@2, 1980[2], FEB-1900, Q2-1980 to name a few. Please note that SVAR only recognizes the word date (in upper or lower case letters) as not being a variable. If we had written "datum" instead (as some people may be inclined to do), then SVAR presumes that this is a variable name, and since the number of variables names will then be greater than the number of variables it will assume that these are not proper variable names. In that case, you can always set the variables names via a control on the Main Program window. Well, in case you want to change those SVAR found in the input file you can also use that function!

 

Alternatively, you can use comma separated values files (*.csv) with their usual format. Commas, semi-colons, colons, tabs and spaces are regarded as column separators  and decimal signs should be represented by the point (full stop) or the comma character. Notice that you should not let the comma sign represent both the decimal sign and the column separator. In the format of a comma separated values file with comma signs as column separator the above format for text files may instead be represented by:

 

"date",  "m",  "p",   "y"

"Q1-1980", 2.2 ,  3.1 ,  4.1

"Q2-1980" ,3.2,   2.8  , 2.1

  .      , .    , .   ,  .

  .      , .    , .   ,  .

  .      , .    , .   ,  .

"Q4-2003" ,5.2   ,7.4,  12.1

 

Notice that the exact placement of the comma sign is not important as SVAR will simply replace the comma with a space character when reading the comma separated values file. Moreover, the use of quotation marks for text is not necessary as SVAR will make its own determination whether or not the element is a text string or a number. In addition, you should not use colons in the date representation since SVAR regards all colons in a comma separated value file as a column separator.