<< Click to Display Table of Contents >> WRITE |
|
The command writes variables to a Gekko databank file (.gbk).
WRITE < period RESPECT > filename ;
WRITE < period RESPECT > variables FILE=filename ;
period |
(Optional). Without a time period indicated, Gekko will write all the data for all observations. When a period is indicated, the written data(bank) is truncated. |
RESPECT |
(Optional). With this option, if no period is given, the global period is used. |
variables |
Variables or lists (wildcards and bank indicators may be used), and items may be separated by commas. If no variables are given, the full first-position databank is written. |
filename |
Filenames may be contain an absolute path like c:\projects\gekko\myfile, a relative path like \gekko\myfile.gbk, or be stated without a path. Filenames containing blanks and special characters should be put inside quotes. See more on filenames here. |
•If no period is given inside the <...> angle brackets, no time period is used.
•If a variable is stated without databank, the databank is assumed to be the first-position databank.
There is the following equivalence between WRITE and EXPORT: WRITE = EXPORT<all>, and the inverse: EXPORT = WRITE<respect>. If a local period is set, WRITE and EXPORT behave in the same way.
You may write the contents of the first-position databank like this:
WRITE data; |
This will produce the file data.gbk, containing the first-position databank. If you only want subset of the variables (or a subset of the time period), you may write for instance:
WRITE<2040 2050> fy, fe, fm FILE=sim4050; |
This produces the file sim4050.gbk, containing the three variables fy, fe, fm over the period 2040-50. If practical, you may also use wild-card lists:
WRITE fx* file=fxfile; |
This writes all variables starting with fX to the file fxfile.gbk. Actually WRITE ** file=databank; is equivalent to WRITE databank;, cf. the wildcards page regarding the double star ** notation. To write a list of strings containing variable names, use {}-curlies:
#m = fy, fe, fm; //or: #m = ('fy', 'fe', 'fm); |
Without the braces, the list #m itself would have been written, not the three series.
If option folder = yes, and option folder bank is set, the WRITE statement tries to write to that particular folder instead of the working folder.
If a model has been loaded, and all the endogenous variables of the model exist in the first-position databank, the WRITE command will store info regarding the model, last simulation period etc. inside the .gbk file. After this, when reading the databank again, a link to this model info is provided. This can be practical when in doubt about when the variables in a given databank were simulated, the simulation period, the model name and signature, etc.
OPTION folder bank = [empty];
READ, IMPORT, EXPORT, SHEET, MODEL