series name in loop

For questions regarding programming in the EViews programming language.

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

dburtis
Posts: 8
Joined: Fri Feb 20, 2015 11:32 am

series name in loop

Postby dburtis » Tue Mar 03, 2015 8:36 pm

Inside a loop i successfully define a series name, but i can't figure out how to use that name subsequently in the loop. The program is

string str_endog = "NA11 NA22 NA23 NA39 NA42 NA46 NA47 NA51 NA52 NA53 NA54 NA55 NA56 NA61 NA62 NA71 NA72 NA81 NA92"
for !i = 1 to @wcount(str_endog)
%b{!i} = @wmid(str_endog,{!i},1)
series dl{%b{!i} } = dlog( {%b{!i} } )
dl{%b{!i} }.X13(save="d10 d11", arimasmpl="1967Q1 2014Q4") @X11()
next

I get an error message: Unmatched curly braces in "dl{%b{!i}" in "DL{%B{!I} }.X13(SAVE="D10 D11", ...

Pls help. Thanks
david

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: series name in loop

Postby trubador » Wed Mar 04, 2015 1:02 am

There is a space between the brackets. And since you generate series that have negative values, you should change the default mode of seasonal adjusment from multiplicative to additive:
dl{%b{!i}}.X13(save="d10 d11", arimasmpl="1967Q1 2014Q4") @X11(mode=add)

dburtis
Posts: 8
Joined: Fri Feb 20, 2015 11:32 am

Re: series name in loop

Postby dburtis » Sat Mar 07, 2015 9:13 am

thank you troubadour; you saved me hours of debugging. Lesson learned for 2nd time: mind your spaces. and thanks for the mode=add coding


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests