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")