Reading data with unknown final period

For questions and discussion related to reading in and working with data.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Reading data with unknown final period

Unread post by TomDoan »

Beginning with Version 8, you have been able to leave the top end of the data range blank and allow it to be data-determined. For instance, the following (which requires RATS Pro), fishes the current data for four series off the FRED database:

cal(q) 1947:1
data(format=fred) / cbi gdp afexpnd afrecpt
disp %datelabel(%allocend())

As I write this, this will give %allocend() of 2012:4, which is when the AFRECPT series ends (it's not as up to date as the other series). The other three series will actually be longer than that, so you can use an INQUIRE instruction to find out their length:

inquire(series=gdp) gstart gend
disp %datelabel(gstart) %datelabel(gend)

By using %allocend() or INQUIRE you can write a program which adjusts to use the most current amount of data.

Note that you do have to set the start period. INQUIRE can help if you have series which start later than others.
Post Reply