Subroutine Local

For questions regarding programming in the EViews programming language.

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

tchaithonov
Posts: 168
Joined: Mon Apr 13, 2009 7:39 am
Location: New York City

Subroutine Local

Postby tchaithonov » Thu Jul 26, 2012 7:47 am

Hey there,

I am writing a subroutine that requires looking data up from a table. I tried to use "subroutine local" because I don't want the program to store any intermediate elements, but somehow I couldn't make it recognize that the table exists (I just refer to the table "TABLE(!i+1,1)" and it keeps saying that it is not defined. Does tables work within local subroutines? Please let me know. Thanks.

Tchaithonov

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13318
Joined: Tue Sep 16, 2008 5:38 pm

Subroutine Local

Postby EViews Gareth » Thu Jul 26, 2012 7:51 am

You called your table "table"?
Follow us on Twitter @IHSEViews

tchaithonov
Posts: 168
Joined: Mon Apr 13, 2009 7:39 am
Location: New York City

Re: Subroutine Local

Postby tchaithonov » Thu Jul 26, 2012 10:04 am

No ;) Just an example. If you want, call it tab_abc.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13318
Joined: Tue Sep 16, 2008 5:38 pm

Re: Subroutine Local

Postby EViews Gareth » Sun Jul 29, 2012 6:35 pm

Seems to work for me:

Code: Select all

create u 100
table a

call foo(a)

show a

subroutine local foo(table mytable)
   !i=1
   mytable(!i+1,1) = "hello"
endsub
Follow us on Twitter @IHSEViews


Return to “Programming”

Who is online

Users browsing this forum: Google [Bot] and 60 guests