Page 1 of 1

nobs per cross-section in panel

Posted: Tue Mar 16, 2010 3:36 pm
by startz
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?

Re: nobs per cross-section in panel

Posted: Tue Mar 16, 2010 4:45 pm
by EViews Glenn
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.

Re: nobs per cross-section in panel

Posted: Tue Mar 16, 2010 5:27 pm
by startz
Thanks Glenn, that's what I needed.