FINDMISSINGDATA

<< Click to Display Table of Contents >>

Navigation:  Gekko User Manual > Gekko statements >

FINDMISSINGDATA

Previous pageReturn to chapter overviewNext page

This statement finds timeseries with missing values (only the timeseries with frequency matching the global frequency setting).

 

Note that the statement is not intended to be put inside a tight loop. In such cases, using the iif() function is better, see the end of the examples section.

 


 

Syntax

 

findmissingdata < period REPLACE=... > variables ;

 

period

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

REPLACE=

You may use for instance <replace = 0> to replace any missing values with 0 (or any other value). When using the REPLACE options, lists are not generated.

variables

List of variable(s) to check, array-series can be stated. If omitted, all series from the first-position databank are investigated.

 

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

If no variables are given, all variables in the first-position databank will be investigated

 


 

Examples

 

For instance, the statement

 

findmissingdata <2008 2010>;

 

looks for all series (including array-subseries) with any missing values in the period 2008-2010. You may restrict it like this:

 

findmissingdata <2008 2010> {#vars};

 

where the list #vars contains the names of the relevant variables you want to check. Gekko outputs a number of lists from the investigation: for instance the list #missingdata contains all variables with missing data in the first-position databank, whereas the lists #missingdata_all, #missingdata_endo etc. are subsets of that list, and correspond to the Gekko-defined lists #all, #endo etc. (i.e., all model variables, all endogenous model variables, etc.).

 

findmissingdata <2008 2010 replace = 0> {#vars};

 

This does not produce any lists, but replaces any missing values with 0.

 

You may use wild-card lists if preferable:

 

findmissingdata <2008 2010> fX*, fYf*;

 

This will check all variables starting with fX or fYf. If a period is not given, the global time setting is used.

 

If you need to change missing values to something else, using the iif() function is often much more speedy. For instance:

 

resetoption freq m;
time 2017m7 2017m10;
= 100, 200, m(), 400;
= 110, 210, 310, 410;
= iif(x, '==', m(), y, x);
prt <n> x, y, z;

 

The result is:

 

                   x              y              z 
  2017                                               
    m7        100.0000       110.0000       100.0000 
    m8        200.0000       210.0000       200.0000 
    m9               M       310.0000       310.0000 
    m10       400.0000       410.0000       400.0000 

 

The x series has a hole in it (2017m9), and the iif() function checks (for each of the four periods) if x has a missing value, and if so it uses the y value, else the x value. So the resulting z series has the hole filled with the 2017m9 observation from y. The m() function inside the iif() function just returns a missing value. A dollar conditional ($) works similar to iif(), and the replace() function can also be used.

 

 


 

Note

 

The statement is convenient when developing new models or changing existing models.

 


 

Related functions

 

allMiss(), bankReplace(), exist(), iif(), isMiss(), replace()

 


 

Related statements

 

COMPARE (see also Utilities --> Compare two databanks (same as COMPARE))