Page 1 of 1

sorting/ ranking the data in a table

Posted: Sun Mar 19, 2017 11:11 pm
by saranya
Hi,

Is there a way to rank elements in a particular column of a table? I went through the rank and sort functions available within eviews. However, was not able to implement the same for a table.

My end requirement is to rank the data series based on the period of observation. Kindly help. I'm also adding the codes I used to find the first period of observation and last period of observation for the variables in the group.

I.e when we use the below codes, I need to rank the data in the 4th and 5th columns of the table named date.

group all *
all.drop resid
%name =""
table date
date(1,1)= "Series Name"
date(1,2)= "Series Strt Date"
date(1,3)= "Series End Date"
date(1,4)= "Start_Datenum"
date(1,5)= "End_Datenum"
for !i=1 to all.@count
%name = all.@seriesname(!i)
%smpl_first= {%name}.@first
%smpl_last= {%name}.@last
!date_st= @dateval(%smpl_first)
!date_end= @dateval(%smpl_last)
date(!i+1,1) = %name
date(!i+1,2)= %smpl_first
date(!i+1,3)= %smpl_last
date(!i+1,4)= !date_st
date(!i+1,5)= !date_end
next

Re: sorting/ ranking the data in a table

Posted: Mon Mar 20, 2017 8:16 am
by EViews Gareth
Unfortunately there is no table sort routine. You would have to put the data into a matrix and sort it there. The TTOM function would be useful.

Re: sorting/ ranking the data in a table

Posted: Tue Mar 21, 2017 2:18 am
by saranya
serves the purpose. Thanks Gareth :)