Time Series - Data and Statistical Services - Princeton University
Time Series - Data and Statistical Services - Princeton University
Time Series - Data and Statistical Services - Princeton University
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Setting as time series: tsset<br />
Once you have the date variable in a ‘date format’ you need to declare your data as time series in order to<br />
use the time series operators. In Stata type:<br />
tsset datevar<br />
. tsset datevar<br />
time variable: datevar, 1957q1 to 2005q1<br />
delta: 1 quarter<br />
If you have gaps in your time series, for example there may not be data available for weekends. This<br />
complicates the analysis using lags for those missing dates. In this case you may want to create a continuous<br />
time trend as follows:<br />
gen time = _n<br />
Then use it to set the time series:<br />
tsset time<br />
In the case of cross-sectional time series type:<br />
sort panel date<br />
by panel: gen time = _n<br />
xtset panel time<br />
6<br />
PU/DSS/OTR