Page 1 of 1

filter the extreme values

Posted: Tue May 20, 2014 5:07 am
by popdycentral
Hi, I usually can find my answers by checking the forum, but this time I have some difficulties in tackling this problem. As I'm new to this software, I thought it might be a good idea to ask help from the forum.
Here is my question:
I have a time series of stock returns over 20 years, and I'd like to create dummy variables for the returns in the top of 10% and below the 10% with a value "1", the returns fall out of this range will give a value "0". I know @recode can filter the data with a given value, however, I don't know how to manipulate the code to find a percentile.

I'm using Eviews 7.
Hope you can help here, thank you in advance!

Re: filter the extreme values

Posted: Tue May 20, 2014 8:59 am
by popdycentral
I figured the command would be:
series xtop10=@recode ( x > @quantile ( x, .10),1,0)
series xbottom10=@recode ( x < @quantile ( x, .90),1,0)

whereas I checked the output, they don't appear to be what I want.

Can anyone help.....?

Re: filter the extreme values

Posted: Tue May 20, 2014 9:08 am
by EViews Esther

Code: Select all

series xtop10 = @recode(x>@quantile(x, .90), 1, 0) series xbottom10 = @recode(x<@quantile(x, .10), 1, 0)

Re: filter the extreme values

Posted: Tue May 20, 2014 10:54 am
by EViews Glenn
And following up on EViews Esther's post, the all-in-one is

Code: Select all

series xrecode = @recode(x>@quantile(x, .90) or x<@quantile(x, .10), 1, 0)

Re: filter the extreme values

Posted: Tue May 20, 2014 11:23 am
by popdycentral
thanK you! That worked.