I estimate equations on rolling time period. I want to freeze the outout with "last date of the rolling time period" extension.
E.g: currently I have data until 2018m12. And i want to name the table with extension _2017m12 (last date-12)
Here is my code:
Code: Select all
for !i=-12 to 0 step 12
smpl 2000:1 {%last}+!i
if !i=-12 then
for %y {%items}
eq_long_{%y}.cointreg(method=ccr, lag=a, info=sic, kern=bart, bw=andrews)
eq_long_{%y}.makeresids ecm_{%y}
if %y="meat" then
estar_meat_ecm=1-exp(-(0.15*((ecm_meat*100-0*100)^2)))
endif
for !j=1 to 6 step 1
scalar sc_l_{%y}_!j=eq_long_{%y}.c(!j)
next
vector(6) vecl_{%y}_{%last+!i}
for !j=1 to 6 step 1
vecl_{%y}_{%last+!i}(!j) = sc_l_{%y}_!j
next
if %y="agrmeat" then
smpl 2001:6 {%last}+!i
eq_short_{%y}.ls(cov=hac, covlag=a, covinfo=sic, covkern=bart, covbw=andrews)
freeze(t_{%y}_{%last+!i}) eq_short_{%y}
else
smpl 2000:1 {%last}+!i
eq_short_{%y}.ls(cov=hac, covlag=a, covinfo=sic, covkern=bart, covbw=andrews)
freeze(t_{%y}_{%last}) eq_short_{%y}
endif
close t_*
next
but the {%last+!i} code does not work.