On Sun, 6 Nov 2011, Andreas Noack Jensen wrote:
I cannot get the internal t variable to work when data is yearly.
Here is an example
# The t valible works when e.g. data is quarterly
nulldata 50
setobs 4 1950:1 --time-series
series tmp = (t > "1960:1")
# But not for yearly data
setobs 1 1950 --time-series
series tmp = (t > "1960")
Would it be easy to extend the behaviour to yearly data?
I'm afraid that the answer to that is No. With any frequency other
than annual data there is no ambiguity between a plain observation
number such as "23" and a time-series index such as "1970:1" (first
quarter of 1970) or "1970:01" (first month of 1970). But with annual
data there is perfect ambiguity between "1664" meaning the 1664th
observation and meaning the year 1664. Obviously, there are possible
heuristics we could employ, but these would be subject to error.
I would suggest that a reasonable method is to define a variable
named "year", as in
genr year = time + 1950
and then use "year" rather than "t" in setting up series such as the
"tmp" that you specify above.
Allin Cottrell