Page 1 of 1

List of series with end date earlier than a benchmark

Posted: Mon Jan 26, 2015 6:59 pm
by troy_walters
Im trying to create a string list of all the series in a workfile whose end date is before a certain benchmark end date which Ive stored as a scalar program variable (using @dateval) called !current. By end date of a series I mean the last non-NA value.

Code: Select all

group short for %co {%alls} smpl if TUBPSF{%co}<>na !end_date = @dateval(@otods(@obs(TUBPSF{%co}))) if !end_date<!current then short.add TUBPSF{%co} endif next %shorts = short.@members
The above code does the job, But Im wondering if there is a more efficient way of doing this, as it seems computationally expensive.

We can do this operation in a single line of code in AREMOS. Thanks!

Re: List of series with end date earlier than a benchmark

Posted: Tue Jan 27, 2015 9:18 am
by EViews Gareth

Code: Select all

%short = =@wquery("<>", "end<mydate")
mydate should be the text representation of the date.

Re: List of series with end date earlier than a benchmark

Posted: Tue Jan 27, 2015 10:51 am
by troy_walters
Thanks but this does not work for me when I attempt to @wquery with an end date. Although it works when I @wquery a database, it does not work in a workfile. The series in my workfile do not have an end attribute associated with them. Is there any way to do this without having to setattr on all my workfile series? There are a lot.

Re: List of series with end date earlier than a benchmark

Posted: Tue Jan 27, 2015 11:25 am
by EViews Gareth
Sorry, yes, you're right.

You'll have to loop through them then like you're doing. But I would just use series.@last to obtain the end date.

Re: List of series with end date earlier than a benchmark

Posted: Tue Jan 27, 2015 1:45 pm
by troy_walters
ok thanks!