Extracting exclude dates

For technical support, tips and tricks, suggestions, or any other information regarding the EViews model object.

Moderators: EViews Gareth, EViews Moderator

Elderfield.A
Posts: 41
Joined: Thu Jul 11, 2019 10:47 pm

Extracting exclude dates

Postby Elderfield.A » Mon Feb 17, 2020 8:35 pm

Hi,

Is there any way to extract the dates that a variable is excluded. Essentially, want to be able to create a string variable that lists all the model excludes as they are in the exclude view of the model. I have used the exclude list command:

Code: Select all

string a = model.@excludelist("scenario")


However, this simply lists the variables, it doesn't contain information regarding the sample which the variable is excluded over. Which is what I need.

Is there a way to do this?

Thanks

Adam

EViews Matt
EViews Developer
Posts: 445
Joined: Thu Apr 25, 2013 7:48 pm

Re: Extracting exclude dates

Postby EViews Matt » Wed Feb 19, 2020 11:32 am

Hello,

I'm afraid there isn't a convenient model data member for retrieving the exclusion sample. I believe the only way to access that information programmatically is to freeze and parse the Scenario View table.

Elderfield.A
Posts: 41
Joined: Thu Jul 11, 2019 10:47 pm

Re: Extracting exclude dates

Postby Elderfield.A » Thu Feb 20, 2020 9:10 pm

Hi Matt,

That is fine, could you please provide some code example as to how you would go about freezing and parsing the table? This could be useful for a number of other applications I have in mind.

Thanks

Adam

EViews Matt
EViews Developer
Posts: 445
Joined: Thu Apr 25, 2013 7:48 pm

Re: Extracting exclude dates

Postby EViews Matt » Fri Feb 21, 2020 6:31 pm

Certainly...

Code: Select all

create u 100

' Simple example model.
series x = nrnd
series y = nrnd
series z = nrnd
var v.ls 1 2 x y z
model m
m.append :v
' Example exclusions in baseline scenario.
m.exclude x("1 50") y("25 75")   

' Create a table from the Scenario View.
freeze(tmp) m.scenlist
' Find the first row in the table corresponding to the scenario we're interested in.
!row = 5
while @neqna(@lower(tmp(!row, 1)), "baseline")
   !row = !row + 1
wend
' Record the exclusion listed on that row.
%excludes = tmp(!row, 3)
' If there are addition exclusions, they will be listed in subsequent rows.
!row = !row + 1
while !row < tmp.@rows and @lower(tmp(!row, 1)) = ""
   %excludes = %excludes + " " + tmp(!row, 3)
   !row = !row + 1
wend
' Record the result in a workfile string for easy viewing.
string result = %excludes

The above could be properly parameterized and turned into a subroutine, but as is it demonstrates going through the table form of the Scenario View and extracting the exclusions for a particular scenario.

Elderfield.A
Posts: 41
Joined: Thu Jul 11, 2019 10:47 pm

Re: Extracting exclude dates

Postby Elderfield.A » Mon Feb 24, 2020 10:10 pm

Thanks Matt - this is really great.


Return to “Models”

Who is online

Users browsing this forum: No registered users and 4 guests