Page 1 of 1

Store a date and use in multiple sample

Posted: Wed Sep 19, 2018 8:01 am
by BatLaMenace
Hi all,

I'm writing a programme in EViews for forecasting purpose. As it is made to be re-used at each forecasting exercise, I'd like to define the starting date (e.g. as of now "2018q3") in the beginning of the programme and then use it through the programme to define estimation samples. I don't know if this introduction is very clear. Maybe the code I wrote would be more informative:

Code: Select all

%prev_start = "2018q3" [...] delete(noerr) s_xtr sample s_xtr @first %prev_start-1 'Using the date to define estimation sample (and I have multiple estimation samples to do) smpl s_xtr equation xtr_ct.ls ... bla bla ... [...] delete(noerr) s_ulc sample s_ulc "2004q1" %prev_start-1 'See: re-using it now for another estimation sample smpl s_ulc equation ulc_ct.ls ... bla bla ...
The above code runs well, but it has to be ran all at once (otherwise, EViews loses the %prev_start from its memory). This is not very convenient as I have to run aaaaaaall my code when updating a single equation.

Is there a way to make the date more permanent in EViews' memory? I tried by doing:

Code: Select all

string prev_start "2018q3" sample s_xxx @first prev_start
But it does not run...

Is there any possibility to make this date more sticky into the memory ?

Thanks, all the best

Re: Store a date and use in multiple sample

Posted: Wed Sep 19, 2018 8:31 am
by EViews Gareth

Code: Select all

string prev_start = "2018q3" sample s_xxx @first {prev_start}
As an aside, you can programmatically determine the current quarter:

Code: Select all

string prev_start = @strnow("YYYY[q]Q")

Re: Store a date and use in multiple sample

Posted: Thu Sep 20, 2018 12:14 am
by BatLaMenace
Works great ! The almighty EViews Gareth has striked again ! Many thanks