Deciles

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator

fhnickel
Posts: 2
Joined: Thu Oct 23, 2008 8:56 am

Deciles

Postby fhnickel » Thu Oct 23, 2008 11:31 am

I have series that contains "na"s and I am looking to find what decile each observation falls into. The series undated. Any help would be appreciated

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11408
Joined: Tue Sep 16, 2008 5:38 pm

Re: Deciles

Postby EViews Gareth » Thu Oct 23, 2008 11:52 am

Something along the lines of this should work.

Code: Select all

series quantiles
for !i=10 to 1 step -1
smpl if x<@quantile(x,!i/10)
quantiles = !i
next
smpl @all
Follow us on Twitter @IHSEViews

EViews Glenn
EViews Developer
Posts: 2555
Joined: Wed Oct 15, 2008 9:17 am

Re: Deciles

Postby EViews Glenn » Thu Oct 23, 2008 3:10 pm

I have series that contains "na"s and I am looking to find what decile each observation falls into. The series undated. Any help would be appreciated


Here's an easier method...use the series "Proc/Generate by Classification". Choose Method = "Quantile Values" and enter "10" as your number of quantiles. We'll create a new series containing the quantiles.

By default we will apply a value map to the resulting output series so that you'll see the ranges for the quantile bins in the default display, but the underlying quantile numbers are there in the series. You can either delete the Valmap specification from the procedure, or turn off the display of the valmap in the resulting series by selecing "Raw data" in the combo in the series toolbar.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 4 guests