Syntax Error in subroutine, please help!

For questions regarding programming in the EViews programming language.

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

Tom Simpson
Posts: 19
Joined: Fri Oct 09, 2009 1:14 am

Syntax Error in subroutine, please help!

Postby Tom Simpson » Mon Jul 12, 2010 10:07 pm

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")
Attachments
susan_july.wf1
(336.75 KiB) Downloaded 287 times

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Syntax Error in subroutine, please help!

Postby EViews Glenn » Tue Jul 13, 2010 9:25 am

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


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests