Page 1 of 1
Extracting exclude dates
Posted: Mon Feb 17, 2020 8:35 pm
by Elderfield.A
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
Re: Extracting exclude dates
Posted: Wed Feb 19, 2020 11:32 am
by EViews Matt
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.
Re: Extracting exclude dates
Posted: Thu Feb 20, 2020 9:10 pm
by Elderfield.A
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
Re: Extracting exclude dates
Posted: Fri Feb 21, 2020 6:31 pm
by EViews Matt
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.
Re: Extracting exclude dates
Posted: Mon Feb 24, 2020 10:10 pm
by Elderfield.A
Thanks Matt - this is really great.