nobs per cross-section in panel

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

startz
Non-normality and collinearity are NOT problems!
Posts: 3797
Joined: Wed Sep 17, 2008 2:25 pm

nobs per cross-section in panel

Postby startz » Tue Mar 16, 2010 3:36 pm

I'm probably missing something obvious, but what's the function to return the number of obsevations in each cross-section in an unbalanced panel?

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

Re: nobs per cross-section in panel

Postby EViews Glenn » Tue Mar 16, 2010 4:45 pm

If you want to link them up to the original observation, use @obsby, as in

Code: Select all

series idcount=@obsby(@crossid, @crossid)
To get the results in a simple vector, you can just grab the first observation in each cross-section and use stom to extract the values

Code: Select all

smpl @all series idcount=@obsby(@crossid, @crossid) smpl if @obsid=1 stom(idcount, counts)
The relational database way of doing this is to create a cross-section only page and linking from the original page, but the above is probably enough for what you want to do.

While the above isn't so bad, what we should do to make this easier is to allow you to output the results from the one-way tabulation into a matrix.

startz
Non-normality and collinearity are NOT problems!
Posts: 3797
Joined: Wed Sep 17, 2008 2:25 pm

Re: nobs per cross-section in panel

Postby startz » Tue Mar 16, 2010 5:27 pm

Thanks Glenn, that's what I needed.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests