|
<< 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.
The time period can be altered temporarily for a given statement, for instance prt <2021 2023> x;. The <2021 2023> field will override the global time period. BLOCK can alter the time period temporarily for several statements inside the BLOCK ... END structure.
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) |
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.
time 2020 2024; |
The first PRT prints for 2021-23, the second PRT likewise, and the last PRT prints for 2020-24. Global frequency is altered this way (here to quarterly):
option freq q; |
This sets the frequency to quarterly (a for annual, q for quarterly, m for monthly, w for weekly, d for daily, u for undated). If quarterly frequency is chosen, time periods are given as for instance:
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 dates syntax regarding quarters and months etc. can be used wherever it is relevant, for instance in the PRT statement:
prt <2000m2 2005m12> x1, x2; |
Gekko will try to convert frequencies, for instance if the global frequency is q (quarterly), setting time 2021 2023; will be equivalent to setting time 2021q1 2023q4;.
To set the value for a single period, you may use one of the following:
x <2021 2021> = 100; |
But note that in the latter case, the x series must exist beforehand.
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.
Local time periods like prt <2010 2015> x; do not allow for the use of a single period, like prt <2010> x;. In contrast, time 2010; is legal (same as time 2010 2010;).
Timeseries may be converted from one frequency to another by means of the COLLAPSE and INTERPOLATE statements.
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.
option freq = a;
currentPerStart(), currentPerEnd()
BLOCK, COLLAPSE, INTERPOLATE, TIMEFILTER