Stata 15 help for _ts


[TS] _ts -- Programmer's command to verify that data are tsset properly


_ts [if] [in] [, options]

options Description ------------------------------------------------------------------------- sort caller requires that time variable be set panel panel variable onepanel time variable -------------------------------------------------------------------------


_ts is used by time-series commands to verify that the data have previously been tsset. _ts does not check that the time variable is still consistent with the value of delta last recorded by tsset, nor does it perform any other consistency checks. If the data have not been tsset, _ts exits with an error message. If you specify the onepanel or panel option, the return code is 459; otherwise, the return code is 111.


sort requests that _ts re-sort the data by the panel variable (if previously declared) and the time variable.

panel indicates that the command calling _ts can be used with panel data. Here _ts verifies that both panel and time variables have been declared. For panel-data applications, we recommend using _xt instead, because it offers more flexibility and more sanity checking.

onepanel indicates that the command calling _ts can be used with panel data if the if and in conditions restrict the estimation sample to a single panel of the panel dataset.


Suppose you are writing a new time-series command that requires the data be tsset. _ts verifies that is the case. Using _ts is much faster than having your command call tsset, because _ts does not perform any calculations on the data; it only checks that _dta[_TStvar] is filled in. When you specify the onepanel or panel option, it also checks _dta[_TSpanel].

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index