Command Reference : Operator and Function Reference : Time Series Functions
  
Time Series Functions
The following functions facilitate working with time series data. Note that NAs will be returned for observations for which lagged values are not available. For example, d(x) returns a missing value for the first observation in the workfile, since the lagged value is not available.
 
Name
Function
Description
d(x)
first difference
where is the lag operator.
d(x,n)
n-th order difference
.
d(x,n,s)
n-th order difference with a seasonal difference at
.
dlog(x)
first difference of the logarithm
.
dlog(x,n)
n-th order difference of the logarithm
.
dlog(x,n,s)
n-th order difference of the logarithm with a seasonal difference at
.
@lag(x, n)
n-th order lag (equivalent to “X(‑4”) for the series X)
@pc(x)
one-period percentage change (in percent)
equals @pch(x)*100
@pch(x)
one-period percentage change (in decimal)
.
@pca(x)
one-period percentage change—annualized (in percent)
equals @pcha(x)*100
@pcha(x)
one-period percentage change—annualized (in decimal)
where is the lag associated with one-year () for quarterly data, etc.).
@pcy(x)
one-year percentage change (in percent)
equals @pchy(x)*100
@pchy(x)
one-year percentage change (in decimal)
, where is the lag associated with one-year () for annual data, etc.).