On Mon, 7 Dec 2009, Raz Lev wrote:
I have a time series, X. the range is, let say, 1990 - 2000.
The frequency is quarters.
I would like to create a new series that depends on the date of X and the date of X.
something like
Y=X+(year of X).
how can I refer to the year / quarter in which the sample was taken?
Example below. Rather than using a loop you could use the modulus
operator, "%", to create series holding the year and quarter.
<script>
open data9-7
n = $nobs
scalar yr, qtr
series z
set messages off
loop i=1..n -q
string s = obslabel(i)
sscanf s, "%d:%d", yr, qtr
z[i] = QNC[i] + yr + qtr
endloop
print QNC z -o
</script>
Allin Cottrell