Extract interval value

For questions regarding programming in the EViews programming language.

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

CySam
Posts: 21
Joined: Thu Mar 27, 2014 10:23 am

Extract interval value

Postby CySam » Thu Mar 27, 2014 10:36 am

Hi, I would like to know in writing a programming, how can I extract the value from a given interval. Let's say, from my one-way tabulation of my series of data, interval values are provided in the table, e.g. [-3.2, -3.1). I want to know how can I extract the lower bound value from the interval. As it doesn't consider as a 'value' so in my programming code, =@val(a,b), does not work as it return me the value as 'NA'.

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: Extract interval value

Postby trubador » Tue Apr 01, 2014 5:20 am

I assume you have already saved the output as a table (see freeze command for details if you did not). Suppose the name of the table is mytab and the interval of interest is stored in the 5th row of the 4th column. The following code should do the trick:

Code: Select all

scalar lbound = @val(@mid(mytab(5,4),2,@instr(mytab(5,4),",")-2))

CySam
Posts: 21
Joined: Thu Mar 27, 2014 10:23 am

Re: Extract interval value

Postby CySam » Wed Apr 02, 2014 1:53 am

Yes, I get the lower bound value from the interval already. Thank you.
By the way, may I know if I want to extract upper bound value what should I change from the code?

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: Extract interval value

Postby trubador » Wed Apr 02, 2014 2:11 am

Code: Select all

scalar ubound = @val(@mid(mytab(5,4),@instr(mytab(5,4),",")+1,@instr(mytab(5,4),")")-@instr(mytab(5,4),",")-1))

CySam
Posts: 21
Joined: Thu Mar 27, 2014 10:23 am

Re: Extract interval value

Postby CySam » Sun Apr 20, 2014 8:04 pm

Ok noted. Thank you very much.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests