List of series with end date earlier than a benchmark

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

troy_walters
Posts: 20
Joined: Thu Jan 15, 2015 9:07 am

List of series with end date earlier than a benchmark

Postby troy_walters » Mon Jan 26, 2015 6:59 pm

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!

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

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

Postby EViews Gareth » Tue Jan 27, 2015 9:18 am

Code: Select all

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

troy_walters
Posts: 20
Joined: Thu Jan 15, 2015 9:07 am

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

Postby troy_walters » Tue Jan 27, 2015 10:51 am

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.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

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

Postby EViews Gareth » Tue Jan 27, 2015 11:25 am

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.

troy_walters
Posts: 20
Joined: Thu Jan 15, 2015 9:07 am

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

Postby troy_walters » Tue Jan 27, 2015 1:45 pm

ok thanks!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests