I'm using pagecontract to filter out stuff in different series using a for loop. My filter is that if their percentage difference is beyond a certain threshold, it is added into the series. And then I'd group those.
The thing is, some series may not have any difference in numbers so the percentage difference would be 0. Then pagecontract will have an error popping up saying that the workfile contraction would leave no observations. And it's fine by me so I want to silence this error and let the rest of the program run.
Here's my code for the percent difference calculation portion:
Code: Select all
'loops through series list
for !j=1 to chgename.@count
'calculates percentdiff for the last 10 years
smpl @last-9 @last
%seriesnam = chgename.@seriesname(!j)
series b{%seriesnam} = @abs(({%seriesnam}_01 - {%seriesnam}) / (({%seriesnam} + {%seriesnam}_01) / 2)) * 100
'filters the series
pagecontract @last-9 @last if b{%seriesnam} > !threshold and b{%seriesnam} <> na
adds series to a group
aresults.add b{%seriesnam}
next
