Page 1 of 1

series name in loop

Posted: Tue Mar 03, 2015 8:36 pm
by dburtis
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

Re: series name in loop

Posted: Wed Mar 04, 2015 1:02 am
by trubador
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)

Re: series name in loop

Posted: Sat Mar 07, 2015 9:13 am
by dburtis
thank you troubadour; you saved me hours of debugging. Lesson learned for 2nd time: mind your spaces. and thanks for the mode=add coding