Group series without NAs after TRAMO-SEATS

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

ww_jones
Posts: 4
Joined: Thu Nov 15, 2018 6:46 am

Group series without NAs after TRAMO-SEATS

Postby ww_jones » Fri Jul 03, 2020 5:59 am

Hi,

I am dealing with the following issue: I have a big number of different time series and I want to run seasonal adjustment using TRAMO-SEATS. I want my code to seasonally adjust all series, however some of them apparently do not need SA and the TS output is just a string of NAs. I want my code to select and group all series that undergo TRAMO-SEATS (i.e. output is real, no NAs) plus all the rest that do need seasonal adjustment.

To illustrate it better - say I have series:

s1, s2, s3

I run TRAMO-SEATS, I have the following output:

s1_sa (x,x,x...), s2_sa (y,y,y...), s3_sa (NA, NA, NA)

I would like my code to group s1_sa, s2_sa and s3 (not s3_sa, since it gives NAs)

Is there an elegant way to do this? Thank you in advance!

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

Re: Group series without NAs after TRAMO-SEATS

Postby EViews Gareth » Fri Jul 03, 2020 8:27 am

Code: Select all

group non_nas
for %j s1 s2 s3
if @obs({%j}_sa) > 0 then
non_nas.add {%j}_sa
endif
next
Follow us on Twitter @IHSEViews

ww_jones
Posts: 4
Joined: Thu Nov 15, 2018 6:46 am

Re: Group series without NAs after TRAMO-SEATS

Postby ww_jones » Sun Jul 05, 2020 8:15 am

Thanks!

Actually I wanted to put all the SA series and the original ones that do not need SA into one group. So I did the following - I run these twice, once for the SAs and once for the NAs and grouped them all together in the end:

Code: Select all



group non_nas
for !i=1 to non_sa.@count   'non_sa is the folder where all the original series were                                     
%j = non_sa.@seriesname(!i)                                 
if @obs({%j}_sa) > 0 then
non_nas.add {%j}_sa   
endif
next

group nas
for !i=1 to non_sa.@count                                     
%j = non_sa.@seriesname(!i)     
if @obs({%j}_sa) = 0 then
nas.add {%j}
endif
next

group all non_nas nas   'grouping them all


Maybe there's a more elegant way, but it worked fine, so thanks again!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 12 guests