TRUNCATE

<< Click to Display Table of Contents >>

Navigation:  Gekko User Manual > Gekko statements >

TRUNCATE

Previous pageReturn to chapter overviewNext page

TRUNCATE shortens a timeseries, so that the observations outside the given period are discarded. The statement will handle normal timeseries and array-timeseries, but will not truncate timeseries stored inside lists or maps.

 


 

Syntax

 

truncate < period > variables ;

 

period

(Optional). Local period, for instance 2010 2020, 2010q1 2020q4 or %per1 %per2+1.

variables

A list of variables to truncate

 

If no period is given inside the <...> angle brackets, the global period is used (cf. TIME).

If a variable is stated without databank, the databank is assumed to be the first-position databank.

Looping: with a list like for instance #= a, b;, you may use truncate x{#m}; to truncate xa and xb.

 


 

Example

 

To remove all data outside the sample 1990-2010 for all variables starting with fx (Gekko is case-insensitive) in the first-position databank:

 

truncate <1990 2010> fx*;

 

You may omit the period:

 

truncate p1, p2, p3;

 

In that case, the three variables are truncated according to the global time period.

 


 

Related statements

 

SERIES