|
<< Click to Display Table of Contents >> FINDMISSINGDATA |
![]() ![]()
|
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.
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
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:
reset; option freq m; |
The result is:
x y z |
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.
The statement is convenient when developing new models or changing existing models.
allMiss(), bankReplace(), exist(), iif(), isMiss(), replace()
COMPARE (see also Utilities --> Compare two databanks (same as COMPARE))