Page 1 of 1

Syntax Error in subroutine, please help!

Posted: Mon Jul 12, 2010 10:07 pm
by Tom Simpson
Hi,

I'm trying to create a subroutine to help with the creation of some dummy variable matrices with corresponding appropriate deletions of data points in the dependent variable vector that don't have a corresponding point in any of the "category" dummy variable matrices (which may be excluded for various reasons). Unfortunately I'm having syntax error messages but I'm not sure where they're coming from. I mean the line "for {%zorro}" seems to be causing the problems but I'm not sure why exactly - it all looks ok as far as I can tell.

The workfile is attached.

Thankyou for your help!

Code: Select all

series ln_price = log(price_per_gram) subroutine maker(string %cat, string %elements) group {%cat} %dog = %cat !mew = 0 %zela = %elements %zorro = "%" + "z " + %zela for {%zorro} !mew = !mew + 1 %ring = %dog + @str(!mew) series {%ring} = {%z} {%dog}.add {%ring} next %bark = %dog + "_tot" series {%bark} for !z = 1 to !mew {%bark} = {%bark} + {%cat}!z next for !z = 1 to !n if {%cat}_tot(!z) = 0 then ln_price(!z) = na endif next endsub call maker("type","amp can coc her phe") call maker("state","wa vic nsw qld sa act")

Re: Syntax Error in subroutine, please help!

Posted: Tue Jul 13, 2010 9:25 am
by EViews Glenn
There may be other problems, but for one, the

Code: Select all

for {%zorro}
isn't a valid for-loop definition. You need something like

Code: Select all

for %a in {%zorro}

Code: Select all

%a = "x y z" for %b in {%a} statusline %b next