← All examples
66

Canonical Grid model

Economics - Authoring a dated series

Pair row dates with column readings while preserving a missing quarter.

Scale
Small
Source
economics-series-authoring.grid
Length
30 lines
Collection
Advanced language
Level
Intermediate
Runtime
Portable
Version
1.0.0
economics-series-authoring.grid
Get Grid
MODEL "Economics - Authoring a dated series"
DESCRIPTION "Pair row dates with column readings while preserving a missing quarter."
VERSION "1.0.0"
AUTHOR "Grid"
TAGS "economics", "econometrics", "authoring", "time-series"

# Both orientations preserve observation order. The third quarter is absent.
ObservationDates = ["2024-01-01", "2024-04-01", "2024-10-01", "2025-01-01"]
Readings = [100; 110; 133.1; 146.41]

# Preserve makes the gap explicit. Reject would refuse this history.
# Open Observations from I/O to paste and preview a revised history.
input Observations = TS.SERIES(ObservationDates, Readings, "Q", "preserve")
output LevelSeries = Observations
output PriorQuarter = TS.LAG(LevelSeries, 1)
output QuarterlyGrowth = TS.PCT_CHANGE(LevelSeries, 1)
output AnnualGrowth = TS.YOY(LevelSeries)
output DataHandling = "Synthetic readings; no sorting, filling, dropping or interpolation."

A1 = "Dated observations with an explicit missing quarter"
A3 = "Levels"
B3 = LevelSeries
A5 = "Prior quarter"
B5 = PriorQuarter
A7 = "Quarterly growth (%)"
B7 = QuarterlyGrowth
A9 = "Annual growth (%)"
B9 = AnnualGrowth
A11 = DataHandling
END MODEL