Page 1 of 1

Easily add a cross section

Posted: Tue May 10, 2011 3:23 pm
by mcabello
Hi!

A little question: how do I easily add a cross section to a panel? Suppose you have a panel structured as pagestruct @date(date) isocode, and that you want to extend the workfile in order to add a new isocode identifier, say "EGY", for Egypt. Is there a quick command to do this?

Thank you very much in advance.

Regards,
Matías Cabello

Re: Easily add a cross section

Posted: Tue May 10, 2011 3:52 pm
by EViews Gareth
It is actually really quite difficult, if you're not bringing data in from a foreign source, rather you're just adding a new empty cross-section. The following code will do it, assuming your panel is balanced:

Code: Select all

!obs = @obsrange 'total number of observations series t = @trend !timepers = @max(t) 'number of time periods !newobs = !obs + !timepers 'new total number of observations pagestruct(freq=u, start=1, end=!newobs) 'remove the panel structure, and add new observations to the workfile page smpl if @trend >= !obs 'set the sample to be just the newly added observations isocode = "EGY" 'set crossid date = date(-!timepers) 'set dateid smpl @all pagestruct @date(dateid) isocode

Re: Easily add a cross section

Posted: Tue May 10, 2011 5:40 pm
by mcabello
Gareth, thank you for the quick reply! Sad that there is no easy command as it is the case with adding more observations.
Regards,
Matías Cabello

Re: Easily add a cross section

Posted: Mon Jul 02, 2012 8:51 am
by niluki
Is there anyway that this could be adapted to an Unbalanced Structure?

Thanks,

Re: Easily add a cross section

Posted: Mon Jul 02, 2012 8:52 am
by EViews Gareth
Not really. Adding an arbitrary unbalanced cross-section is very difficult.