Page 1 of 1

Extract number of rows in a table

Posted: Wed Dec 23, 2009 12:15 pm
by rdwest
Hi,
Simple question: I'm using Eviews 6, and I can't seem to find a data member that reports the number of rows in a table. Is there something similar to the command .@rows for matrices that can be used for tables?

Thanks.

Re: Extract number of rows in a table

Posted: Wed Dec 23, 2009 2:48 pm
by EViews Gareth
Tables don't really have a number of rows (or columns), thus there is no data member, or, in fact, any way to find out the number of rows.

Yes, this is frustrating.

Re: Extract number of rows in a table

Posted: Tue Jan 05, 2010 9:01 am
by rdwest
Hm. Thank you.

I was aiming to produce a unique list of regressors among a set of about 100 regressions. There are 40 or so unique explanatory variables, and each equation uses between 5 and 8 of them. I've examined your code from the post "An introduction to EViews programming":

......



string allregs = ""
for !i = 1 to @wcount(%eqnames)
%eqname = @word(%eqnames,!i) 'get ith equation name
%vars = {%eqname}.@wregressors
%vars = @wmid(%vars,2) 'drop dependent variable
allregs = allregs + " " + %vars
next

'remove duplicates from regressor list
allregs = @wunique(allregs)




.....but since I'm using Eviews 6, I don't think I have the @wregressors or @wunique commands at my disposal.

I've tried approaching the issue another way: freezing the output of each individual regression, and extracting the coefficients. This works, but I want a


table results_regressor
scalar m = 100

for !i=1 to m

freeze(table_ld{!i}) ld{!i}.stats 'freeze output to extract regressor names
for !j= 9 to 9+ld{!i}.@ncoefs
results_regressors({!j}-7,{!i}+1)= table_ld{!i}({!j},1) 'table for regressor names
results_regressors(!j-7,1) = "beta" + @str(!j-8) 'label coefficients
results_regressors(1,1) = "Equation Number"
setcell(results_regressors, 1, {!i}+1,{!i}, 0)

next
next


This works, but I want a unique list in a single column (rather than 100 columns of varying length).

I tried modifying by adding (within the second loop):

for !k = 1 to n
if table_ld{!i}(!j,1) <> results_all(!k,1) then
results_all(n+1,1) = table_ld{!i}(!j,1)
n = n+1
endif
next


However, the table results_all (created at the beginning of the program) comes back blank.

Any insight or better ideas on how to create this list?

Many thanks,
R.

Re: Extract number of rows in a table

Posted: Tue Jan 05, 2010 9:59 am
by EViews Gareth
Can't think of any easy way to do it in EV6 (well other than upgrading to 7!)

Re: Extract number of rows in a table

Posted: Tue Jan 05, 2010 10:37 am
by rdwest
I give up; my colleagues and I have gotten that reply for most of our questions:

I might as well go ahead and ask whether there's an easy and inexpensive way to upgrade from 6 to 7, since apparently the difference in functionality is vast. (That's disappointing; we just purchased Eviews a little over two months ago.)


Thanks.

Rachel

Re: Extract number of rows in a table

Posted: Tue Jan 05, 2010 10:45 am
by EViews Gareth
Contact our office (sales@eviews.com) for pricing.