<< Click to Display Table of Contents >> TIME |
The TIME statement sets global time used for subsequent time series operations etc. The statement works for frequencies annual (a), quarterly (q), monthly (m), weekly (w), daily (d) and undated (u). The TIME statement is the only way to change global time. Dates have formats like 2020, 2020q3, 2020m3 or 2020m3d25. Note that week numbering follows the ISO 8601 standard.
time periods ;
time period ;
time ? ;
periods |
per1 per2 |
per1 |
Start period, for instance 2010 or 2010q1 |
per2 |
End period, for instance 2012 or 2012q4 |
period |
A single date that will be used as both start and end period. |
? |
Shows the current time settings (also shown at the bottom of the main window) |
If you only want to consider the year 2010, write:
time 2010 2010 ; |
If you want to use the period 1980 to 2010, write:
time 1980 2010; |
statements like SERIES, PRT etc. respect global time if no time period is indicated in the local <>-option field. In all the relevant statements (i.e. all statements operating on time series), a local time period can be set inside the <> brackets, operating on only the particular statement line.
Global frequency is altered this way (here to quarterly):
option freq q; |
This sets the frequency to quarterly ('m' for monthly, 'a' for annual, 'u' for undated). If quarterly frequency is chosen, time periods are given as:
time 2000q2 2005q4; |
That is, from second quarter of 2000 to fourth quarter of 2005 (both inclusive). Months work similarly, for instance:
time 2000m2 2005m12; |
This syntax regarding quarters and months can be used wherever it is relevant, for instance in the PRT statement:
prt <2000m2 2005m12> fy, enl; |
When the frequency is non-annual, you can still denote the time period by means of integers (i.e. years). In that case, the full span of the sub-period is assumed: for instance with quarterly frequency set, prt <2010 2012> would be equivalent to prt <2010q1 2012q4>, and time 2010 2012 would be equivalent to time 2010q1 2012q4. Gekko will generally try to convert dates with "foreign" frequency into the current frequency. Note: if the frequency is quarterly, the following TIME statement
time 2010; |
will span 2010q1 to 2010q4, that is, the statement covers all the subperiods.
With annual frequency, if you write a number small enough, Gekko assumes that you intend to add 1900 to the number. So Gekko tranlates 95 into 1995 for instance. Actually, in this way, you may write 125 instead of 2025, although this way of writing is not recommended.
Timeseries may be converted from one frequency to another by means of the COLLAPSE and INTERPOLATE comands.
The TIMEFILTER statement may omit observations when printing etc., but can also be used to average the non-shown periods into the shown periods. This can be practical for timeperiods with many observations.
Local time periods like prt<2010 2015>x; do not allow the use of a single period, like prt<2010>x;. A series statement can omit the 'SERIES' but keep the local time period, for instance:
x <2020m1 2025m12> = 100; //same as series <2020m1 2025m12> x = 100; |
TIMEFILTER, COLLAPSE, BLOCK, OPTION freq = ...