A simple problem with a subroutine

For questions regarding programming in the EViews programming language.

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

epeter
Posts: 16
Joined: Wed May 28, 2014 1:59 am

A simple problem with a subroutine

Postby epeter » Tue Jul 01, 2014 6:35 am

Hi eveyone,

I apologize in advance for my poor english!
I have a little problem with a subroutine, and i'll be grateful if you could help me.
While writing this simple subroutine, i always get the message "N is not defined or is an illegal command in N=@obs(series x)".
Since I'm new to EViews, i guess the problem could be fixed very briefly by one of you.

Here is the code i wrote

Code: Select all

subroutine local sub (series x, scalar y) n =@obs(series x) banda sup 1,96*1/sqrt(n) banda inf= -1,96*1/sqrt(n) !contatore= 0 for !i=1 to 10 scalar c = @cor(x), x(-!i) if c< banda inf and c> banda sup !contatore= !contatore + 1 endif next scalar y= contatore/10 endsub
With writing n=@obs(series x), i just want it to take into account that the number of observations of my series change.

Thanks in advance to all of you!

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

Re: A simple problem with a subroutine

Postby EViews Gareth » Tue Jul 01, 2014 9:10 am

Use !N rather than N

epeter
Posts: 16
Joined: Wed May 28, 2014 1:59 am

Re: A simple problem with a subroutine

Postby epeter » Mon Jul 07, 2014 2:08 am

Thank you!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests