On Mon, 9 Sep 2013, Sven Schreiber wrote:
At the end of the message I have a real-world data excerpt with all
the
realtime data for two periods, namely 2001m10 (aka 2001-10-01) and
2001m11 (aka 2001-11-01). For certain reasons I'm interested in the
vintage of 2010-06-24, which means the following lines in this example
(with realtime_start_date in the 3rd and realtime_end_date in the 4th
col, see below):
2001-10-01 98.4253 20090327 20100624
2001-11-01 97.9427 20090327 20100624
Inside my functions, I'm using the following join command (where
strvin="2010-06-24":
<hansl>
# and also get the corresponding start dates to verify
join @fpath startdates --tkey=observation_date --time="%Y-%m-%d" \
--data=realtime_start_date --filter="realtime_end_date >= @strvin" \
--aggr="seq:1"
</hansl>
Verbally, this should look for the vintage of 2010-06-24 (with a
workaround: vintages whose validity did not end before the date
2010-06-24, and take the first of these), and then give me _not_ the
value of the variable, but the date when this vintage was published.
Now, gretl gives me the following output in the 'startdates' series:
2001:10 20090327
2001:11 20100625
Notice that the first value gets the correct publication date (see
above), but the second value is wrong; it is the publication date of the
_following_ vintage, which after applying the filter in join should be
the 2nd matching line, not the 1st one as requested per "seq:1". Or like
I said before, it is as if gretl is partially filtering by ">" instead
of ">=" suddenly.
Or am I missing a bug in my own commands here?
Well, as stated above the "join" command doesn't work with the data given
below. Your filter
--filter="realtime_end_date >= 2010-06-04"
fails since the realtime_* columns are in numerical form, not YYYY-MM-DD.
If I correct the filter to
--filter="realtime_end_date>=20100624"
I get the results you were expecting. Call your data rtdata.txt. Then the
following works OK:
<hansl>
nulldata 2
setobs 12 2001:10 --time-series
string strvin = "20100624"
join rtdata.txt startdates --tkey=observation_date --time="%Y-%m-%d" \
--data=realtime_start_date --filter="realtime_end_date>=@strvin" \
--aggr="seq:1"
join rtdata.txt INDPRO --tkey=observation_date --time="%Y-%m-%d" \
--filter="realtime_end_date>=@strvin" --aggr="seq:1"
join rtdata.txt realtime_end_date --tkey=observation_date \
--time="%Y-%m-%d" --filter="realtime_end_date>=@strvin" \
--aggr="seq:1"
print INDPRO startdates realtime_end_date -o
</hansl>
<output>
INDPRO startdates realtime_end_date
2001:10 98.4253 20090327 20100624
2001:11 97.9427 20090327 20100624
</output>
Allin
-------------------------------------
<realtimedata>
observation_date INDPRO realtime_start_date realtime_end_date
...
2001-10-01 139.3070 20011116 20011126
2001-10-01 136.8910 20011127 20011213
2001-10-01 137.5510 20011214 20020115
2001-10-01 137.4540 20020116 20020214
2001-10-01 137.6700 20020215 20021204
2001-10-01 109.5120 20021205 20031109
2001-10-01 109.9120 20031110 20041221
2001-10-01 109.7380 20041222 20051106
2001-10-01 98.3450 20051107 20060413
2001-10-01 98.3453 20060414 20061210
2001-10-01 98.2665 20061211 20080327
2001-10-01 98.4163 20080328 20090326
2001-10-01 98.4253 20090327 20100624
2001-10-01 87.4715 20100625 20110324
2001-10-01 87.4550 20110325 20120329
2001-10-01 87.7031 20120330 20130321
2001-10-01 87.6738 20130322 99999999
2001-11-01 137.1390 20011214 20020115
2001-11-01 136.9030 20020116 20020214
2001-11-01 137.0970 20020215 20020314
2001-11-01 137.2400 20020315 20021204
2001-11-01 108.8450 20021205 20031109
2001-11-01 109.3540 20031110 20041221
2001-11-01 109.1850 20041222 20051106
2001-11-01 97.9060 20051107 20060413
2001-11-01 97.9061 20060414 20061210
2001-11-01 97.7567 20061211 20080327
2001-11-01 97.8874 20080328 20090326
2001-11-01 97.9427 20090327 20100624
2001-11-01 87.0363 20100625 20110324
2001-11-01 87.0138 20110325 20120329
2001-11-01 87.2363 20120330 20130321
2001-11-01 87.2008 20130322 99999999
</realtimedata>
_______________________________________________
Gretl-devel mailing list
Gretl-devel(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-devel
--
Allin Cottrell
Department of Economics
Wake Forest University, NC