Please help me. I have a variable, let's say the name of the variable is 'y'
I want to sort it based on quartiles in each year.
So I want to create another series, let's say series y_quan, that consists only the first 25% quartiles of variable y that has been sorted in each firm-year.
I noticed that we have @quantilesby formula. I have tried @quantilesby(y,@year,(0.25)) -> but this will give me the values of the firm-year quantiles. What I need is to create a series (y_quan) that consist the values of variable y, if it is in the 25%quartiles group.
I would like to also create another series for 25-50% quartiles group, 50-75% quartiles group, and 75% - 100% quartiles group.
Thanks
Sorting the sample based on quantiles
Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator
-
- EViews Developer
- Posts: 563
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Sorting the sample based on quantiles
A combination of @quartilesby and @recode can partition the data in the way you describe, for example,
Code: Select all
series y_0_25 = @recode(y < @quantilesby(y, @year, .25), y, na)
series y_25_50 = @recode(y >= @quantilesby(y, @year, .25) and y < @quantilesby(y, @year, .5), y, na)
etc.
Who is online
Users browsing this forum: No registered users and 23 guests