Page 1 of 1

Creating Quartiles (Q1 and Q3)

Posted: Fri May 12, 2017 10:17 am
by Thomaaatke
Hi Everyone,


I try to delete the middle 50% of observations by only keeping the 25% lowest (Q1) and 25% highest (Q3) observations. I tried to make Quartiles by proc by classification but when I select 4 quartiles, i don't know how to delete the middel 50% oberservations. Is there an easy way to do this or do i have to use excel for this.

Thanks in advance,

Thomaaatke

Re: Creating Quartiles (Q1 and Q3)

Posted: Fri May 12, 2017 10:32 am
by EViews Gareth
Not sure what you mean by "delete", but here's some code that NAs the middle out.

Code: Select all

Series y = @recode(x<@quantile(x,0.25) or x>@quantile(x,0.75), x, na)

Re: Creating Quartiles (Q1 and Q3)

Posted: Fri May 12, 2017 10:35 am
by startz
something like
smpl if y<quantile(y,.25) or y>@quantile(y,.75)

Re: Creating Quartiles (Q1 and Q3)

Posted: Tue May 16, 2017 4:09 am
by Thomaaatke
Thanks a lot!