Fill time series: fill_time_series

Syntax

fill_time_series ( op { , limitsMethod } )

limitsMethod ::= single | all

Input parameters

op

the operand

limitsMethod

method for determining the limits of the time interval to be filled (default: all)

Examples of valid syntaxes

fill_time_series ( ds )
fill_time_series ( ds, all )

Semantics for scalar operations

The fill_time_series operator does not perform scalar operations.

Input parameters type

op

dataset { identifier <time > _ , identifier _* }

Result type

result

dataset { identifier <time > _ , identifier _* }

Additional Constraints

The operand op has an Identifier of type time, date or time_period and may have other Identifiers.

Behaviour

This operator can be applied only on Data Sets of time series and returns a Data Set of time series.

The operator fills the possibly missing Data Points of all the time series belonging to the operand op within the time limits automatically determined by applying the limit_method.

If limitsMethod is all, the time limits are determined with reference to all the time_series of the Data Set: the limits are the minimum and the maximum values of the reference time Identifier Component of the Data Set.

If limitsMethod is single, the time limits are determined with reference to each single time_series of the Data Set: the limits are the minimum and the maximum values of the reference time Identifier Component of the time series.

The expected Data Points are determined, for each time series, by considering the limits above and the period (frequency) of the time series: all the Identifiers are kept unchanged except the reference time Identifier, which is increased of one period at a time (e.g. day, week, month, quarter, year) from the lower to the upper time limit. For each increase, an expected Data Point is identified.

If this expected Data Points is missing, it is added to the Data Set. For the added Data Points, Measures and Attributes assume the NULL value.

The output Data Set has the same Identifier, Measure and Attribute Components as the operand Data Set. The output Data Set contains the same time series as the operand, because the time series Identifiers (all the Identifiers except the reference time Identifier) are not changed.

As mentioned in the section “Behaviour of the Time Operators”, the operator is assumed to know which is the reference time Identifier as well as the period of each time series. Some valid examples could be: fill_time_series ( ds ), fill_time_series ( ds, all ).

Examples

As described in the User Manual, the time data type is the intervening time between two time points and using the ISO 8601 standard it can be expressed through a start date and an end date separated by a slash at any precision. In the examples relevant to the time data type the precision is set at the level of month and the time format YYYY-MM/YYYY-MM is used.

Given:

  • The operand dataset DS_1, which contains annual time series, where Id_2 is the reference time Identifier of time type;

  • the operand dataset DS_2, which contains annual time series, where Id_2 is the reference time Identifier of date type and conventionally each period is identified by its last day;

  • the operand dataset DS_3, which contains annual time series, where Id_2 is the reference time Identifier of time_period type;

  • and the operand dataset DS_4, which contains both quarterly and annual time series relevant to the same phenomenon “A”, where Id_2 is the reference time Identifier of time_period type:

Input DS_1 (see structure)

Id_1

Id_2

Me_1

A

2010M1/2010M12

hello world

A

2012M1/2012M12

say hello

A

2013M1/2013M12

he

B

2011M1/2011M12

hi, hello!

B

2012M1/2012M12

hi

B

2014M1/2014M12

hello!

Input DS_2 (see structure)

Id_1

Id_2

Me_1

A

2010-12-31

hello world

A

2012-12-31

say hello

A

2013-12-31

he

B

2011-12-31

hi, hello!

B

2012-12-31

hi

B

2014-12-31

hello!

Input DS_3 (see structure)

Id_1

Id_2

Me_1

A

2010

hello world

A

2012

say hello

A

2013

he

B

2011

hi, hello!

B

2012

hi

B

2014

hello!

Input DS_4 (see structure)

Id_1

Id_2

Me_1

A

2010

hello world

A

2012

say hello

A

2010Q1

he

A

2010Q2

hi, hello!

A

2010Q4

hi

A

2011Q2

hello!

Example 1

DS_r := fill_time_series ( DS_1, single );

results in (see structure):

DS_r

Id_1

Id_2

Me_1

A

2010M1/2010M12

hello world

A

2011M1/2011M12

A

2012M1/2012M12

say hello

A

2013M1/2013M12

he

B

2011M1/2011M12

hi, hello!

B

2012M1/2012M12

hi

B

2013M1/2013M12

B

2014M1/2014M12

hello!

Example 2

DS_r := fill_time_series ( DS_1, all );

results in (see structure):

DS_r

Id_1

Id_2

Me_1

A

2010M1/2010M12

hello world

A

2011M1/2011M12

A

2012M1/2012M12

say hello

A

2013M1/2013M12

he

A

2014M1/2014M12

B

2010M1/2010M12

B

2011M1/2011M12

hi, hello!

B

2012M1/2012M12

hi

B

2013M1/2013M12

B

2014M1/2014M12

hello!

Example 3

DS_r := fill_time_series ( DS_2, single );

results in (see structure):

DS_r

Id_1

Id_2

Me_1

A

2010-12-31

hello world

A

2011-12-31

A

2012-12-31

say hello

A

2013-12-31

he

B

2011-12-31

hi, hello!

B

2012-12-31

hi

B

2013-12-31

B

2014-12-31

hello!

Example 4

DS_r := fill_time_series ( DS_2, all );

results in (see structure):

DS_r

Id_1

Id_2

Me_1

A

2010-12-31

hello world

A

2011-12-31

A

2012-12-31

say hello

A

2013-12-31

he

A

2014-12-31

B

2010-12-31

B

2011-12-31

hi, hello!

B

2012-12-31

hi

B

2013-12-31

B

2014-12-31

hello!

Example 5

DS_r := fill_time_series ( DS_3, single );

results in (see structure):

DS_r

Id_1

Id_2

Me_1

A

2010

hello world

A

2011

A

2012

say hello

A

2013

he

B

2011

hi, hello!

B

2012

hi

B

2013

B

2014

hello!

Example 6

DS_r := fill_time_series ( DS_3, all );

results in (see structure):

DS_r

Id_1

Id_2

Me_1

A

2010

hello world

A

2011

A

2012

say hello

A

2013

he

A

2014

B

2010

B

2011

hi, hello!

B

2012

hi

B

2013

B

2014

hello!

Example 7

DS_r := fill_time_series ( DS_4, single );

results in (see structure):

DS_r

Id_1

Id_2

Me_1

A

2010

hello world

A

2011

A

2012

say hello

A

2010Q1

he

A

2010Q2

hi, hello!

A

2010Q3

A

2010Q4

hi

A

2011Q1

A

2011Q2

hello!

Example 8

DS_r := fill_time_series ( DS_4, all );

results in (see structure):

DS_r

Id_1

Id_2

Me_1

A

2010

hello world

A

2011

A

2012

say hello

A

2010-Q1

he

A

2010-Q2

hi, hello!

A

2010-Q3

A

2010-Q4

hi

A

2011-Q1

A

2011-Q2

hello!

A

2011-Q3

A

2011-Q4

A

2012-Q1

A

2012-Q2

A

2012-Q3

A

2012-Q4