Dynamic Sample Setting Using Strings
Posted: Tue May 17, 2011 12:10 pm
I am running into a very unusual problem. I am working with real-time data, and the series have been named according to their vintage ie. gdp_jan2009 corresponds to the GDP release from January 2009.
I am trying to update some old RATS code to run in eViews. The idea is that we loop through all of the series, tracking what the last date was, and store the corresponding estimates from each date. The problem that I run into is in setting the dates:
The equation_bench_test uses the correct sample for the April 2009 GDP release, estimating over 1970Q1 to 2008Q4. Indeed, in the first loop, where I create my tracking scalars, everything works well also, with all of the scalars created with the appropriate names. It is the second loop that doesn't work - the sample is continually set to 1970Q1 1998Q3 (which incidentally corresponds to the last observation of the first series - the january 1999 vintage). I can't for the life of me figure out a way to get the sample to change correctly.
I'd like to be able to use the smpl command to store all of the estimated betas in the corresponding end of sample date to create several time series (the first loop helps me to create multiple series for vintages in a given quarter). Does anyone have any experience writing this type of loop?
Many, mank thanks.
EDIT: Forgot to mention that I am using EViews 6.
I am trying to update some old RATS code to run in eViews. The idea is that we loop through all of the series, tracking what the last date was, and store the corresponding estimates from each date. The problem that I run into is in setting the dates:
Code: Select all
%fin = @otod(@ilast(gdp_apr2009))
smpl 1970Q1 %fin
equation eq_bench_test.ls gdp_apr2009 c gdp_apr2009(-1)
'stop
'Initialization - need a series of scalars for each quarter that tracks how many times that has been the last quarter (may be between 2 and 4 revisions for each quarter)
for !yr = 1999 to 2011
for %i jan feb mar apr may jun jul aug sep oct dec
%fin = @otod(@ilast(gdp_{%i}{!yr}))
scalar numlast_{%fin} = 1
next
next
for !yr = 1999 to 2011
for %i jan feb mar apr may jun jul aug sep oct dec
%fin = @otod(@ilast(gdp_{%i}{!yr}))
smpl 1970Q1 %fin
equation eq_bench_{%i}{!yr}.ls gdp_{%i}{!yr} c gdp_{%i}{!yr}(-1)
next
next
I'd like to be able to use the smpl command to store all of the estimated betas in the corresponding end of sample date to create several time series (the first loop helps me to create multiple series for vintages in a given quarter). Does anyone have any experience writing this type of loop?
Many, mank thanks.
EDIT: Forgot to mention that I am using EViews 6.