= TsSet = The '''`tsset`''' command declares a time series dataset. <> ---- == Usage == {{{ . webuse gdp2 (Federal Reserve Economic Data, St. Louis Fed) . tsset daten Time variable: daten, 01jan1952 to 01oct2010, but with gaps Delta: 1 day . tsset tq Time variable: tq, 1952q1 to 2010q4 Delta: 1 month }}} Stata will indicate if there are gaps in observations. A common issue is misspecifying the time units (e.g., specifying a date for time series data that was collected weekly) ---- == Operators == Time series variable operators: * `L.foo` = lagged reference * `LN.foo` = reference lagged by `N` time periods * `F.foo` = forward reference * `FN.foo` = reference forwarded by `N` time periods * `D.foo` = difference between `L.foo` and `foo` * `DN.foo` = difference between `LN.foo` and `foo` * `S.foo` = seasonal difference between `L.foo` and `foo` * `SN.foo` = seasonal difference between `LN.foo` and `foo` Note also that the operators are case-insensitive. As an example: {{{ webuse gdp2 tsset tq // Create new variables generate l_gdp_ln = l.gdp_ln generate l_l_gdp_ln = l2.gdp_ln // Directly reference regress gdp_ln l.gdp_ln }}} ---- == Analysis == {{{ twoway (line gdp_ln tq) }}} ---- CategoryRicottone