Disjunction of text and values

For questions regarding programming in the EViews programming language.

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

Katjes
Posts: 55
Joined: Thu Oct 02, 2008 5:46 am

Disjunction of text and values

Postby Katjes » Thu Oct 02, 2008 6:49 am

After freezing e.g. the table with Johansen cointegration test results you can simply retrieve the cells content:

Code: Select all

scalar x = @val(tab1(12,3))
or

Code: Select all

%x = @str(tab1(10,3))

But how can I separate between text and values in one cell? The cell tab(1,3) contains e.g. "Included observations: 113", but I only want to select the value "113".
Thanks for helpful comments!

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

Postby EViews Gareth » Thu Oct 02, 2008 7:59 am

You can use some string functions to extract the number part of the string, and then convert that part into a number. The following example does this by searching for a ":" in the string, then converting the text following the ":" into a number:

Code: Select all

%temp = tab1(1,3)
!i = @instr(%temp,":")
%temp2 = @mid(%temp,!i+2)
!obs = @val(%temp2)


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 40 guests