cross id

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

basil
Posts: 37
Joined: Thu Apr 28, 2011 11:48 am

cross id

Postby basil » Fri May 13, 2011 7:59 am

I will appreciate your help in the following questions:
(1) Is there a function that provide the number of cross-section IDs?
My solution is:
series cxid=@crossid
scalar cxidnum=@max(cxid)
Is there more elegant way?

(2) Is there a function that gives the list of distinct cross-section IDs?

(3) How do I get the value of the cross-section ID for the given sample?
The function @crossid provides a series of numeric values (e.g., like labels), but I would like to know the actual value of the cross-section ID. For example, assume that I restrict the smpl cxid=5, and I would like to record the actual value of cross-section ID.

(4) Is there a function that provides the p-value for LS?
My solution:
@tdist(reg1.@tstats(!i),reg1.@regobs-reg1.@ncoef)
Is there more elegant way?

(5) How can I store and read the value of a group's correlation?
My solution is to save them into a table:
freeze(mode=overwrite, Est_Corr) group1.cor
x=x+Est_Corr(4,2)
I notices that I cannot do something like:
matrix Est_corr=group1.cor
x=x+Est_Corr(2,1)

(6) How do I "next" in the middle of the loop?
Assume I have a "for" loop. Inside the loop, there is an "if" statement that if it true, I would like to move to the next value of the loop. For example:
for !i=1 to 10
if !i=1 then next
!z=!z+!i
next
Of course the "next" in the middle of the loop does not work or does "return". If I use "exitloop", then EViews exits the for statement all together instead of looping to next value of !i. Would would be the command to force the computer to loop to the next value of !i?

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

Re: cross id

Postby EViews Gareth » Fri May 13, 2011 8:37 am

1) No - your current method is the best.

2) No.

3) You can't (at least not without some ridiculously complicated programming).

4) No, your current method is the best.

5) The cor command has options to store the output in matrices or tables, etc...

6) You can't. You'll have to use if-else conditions to branch inside the loop.

basil
Posts: 37
Joined: Thu Apr 28, 2011 11:48 am

Re: cross id

Postby basil » Fri May 13, 2011 8:48 am

many thanks.

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: cross id

Postby EViews Glenn » Fri May 13, 2011 10:32 am

For (2) and (3) it may not quite be what you want, but if you do a one-way tabulation of the cross-section id series (unchecking all of the grouping boxes), you'll get a list of the cross-sections in the sample.

basil
Posts: 37
Joined: Thu Apr 28, 2011 11:48 am

Re: cross id

Postby basil » Fri May 13, 2011 11:16 am

Thanks. That's what I did, indeed (i.e., "freeze(mode=overwrite, syms) sym.freq(nov,noa)".

A quick follow-up to question 5. Is this what you meant: "group1.cor(mode=overwrite, Out=Group1_)"? This solution does work. When running on verbose mode, this command pops up the correlation matrix Group1_Corr. This is fine except that two things: (1) I guess having Group1_Corr viewed and updated on the screen during run time will slow down performance, (2) This matrix is big and comes on top of other views that I would like to watch being updated during runtime.

Is there an option for this command (i..e, cor) that suppresses the view of the matrix that it creates?

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

Re: cross id

Postby EViews Gareth » Fri May 13, 2011 11:19 am

As with most EViews commands, you can append a "do" to the front:

Code: Select all

do group1.cor(mode=overwrite, Out=Group1_)

basil
Posts: 37
Joined: Thu Apr 28, 2011 11:48 am

Re: cross id

Postby basil » Fri May 13, 2011 11:39 am

beautiful. Thanks a lot.

mcabello
Posts: 7
Joined: Tue May 10, 2011 2:51 pm

Re: cross id

Postby mcabello » Mon May 30, 2011 1:43 pm

I would find it very useful to have quick commands for all those points above, specially from 1 to 4. I think I typed 1 more than 1000 times so far :wink: , and any way out creating tables--as the proposal for 3-- I do not like that much because possible changes in the heading lines make such solutions unstable (e.g. the name of the first cxid may move from A9 to A10 or so if the size of the smpl string increases).
Great post basil!
regards,
Matías


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests