I'm having trouble understanding how the -keep- option of the -rolling- command actually works. For example, this code
produces output like this:
According to the documentation, I expected the -keep- option to preserve the -date- variable from the end of the window, so I expected it to match the -end- variable. Instead, it's many periods ahead, and after the observation where start == 1994q4, the -date- variable is missing. What's going on here?
Furthermore, in this example:
the output is like this
Once again, I would expect the kept variable to match the ending date, but instead it's missing and the name doesn't seem right (-date- vs -daten-). How do I actually use this option?
I want to carry my date variable through for merging purposes, because the carried-through date variable should match the end of the window.
Code:
sysuse gnp96, clear rolling s = r(sum), window(4) keep(date) clear: summ gnp96
Code:
start end date s 1967q1 1967q4 1974q3 14651.2 1967q2 1968q1 1974q4 14777.1 1967q3 1968q2 1975q1 14950.9 1967q4 1968q3 1975q2 15120.5 1968q1 1968q4 1975q3 15279.2 1968q2 1969q1 1975q4 15428.5 1968q3 1969q2 1976q1 15525.2 1968q4 1969q3 1976q2 15621.4 1969q1 1969q4 1976q3 15682.5 1969q2 1970q1 1976q4 15697.7 etc.
Furthermore, in this example:
Code:
freduse GS10, clear drop if year(daten) < 2005 replace daten = mofd(daten) format %tm daten tsset daten rolling s = r(sum), window(5) keep(daten) clear: summ GS10 list in 1/10, clean noobs
Code:
start end date s 2005m1 2005m5 . 21.37 2005m2 2005m6 . 21.15 2005m3 2005m7 . 21.16 2005m4 2005m8 . 20.92 2005m5 2005m9 . 20.78 2005m6 2005m10 . 21.1 2005m7 2005m11 . 21.64 2005m8 2005m12 . 21.93 2005m9 2006m1 . 22.09 2005m10 2006m2 . 22.46 etc.
I want to carry my date variable through for merging purposes, because the carried-through date variable should match the end of the window.
Comment