Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: recover the dimensions of a panel


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: recover the dimensions of a panel
Date   Fri, 5 Jun 2009 09:15:46 +0000 (GMT)

--- On Fri, 5/6/09, Paulo Regiswrote:
> I am working with a panel, and also need to do some matrix
> operations. The problem is the matrices dimensions depend 
> on the T and N dimensions of the panel. Some times, I have
> to drop obs and the dimension may change so I need to
> revise what are the dimensions of the panel. Things are
> even more complicated if I use a do file.
> 
> Is there any easy way to do this? I usually work with
> -tsset but, unfortunately, i did not find the way to get
> the dimensions of timevar or panelvar.

Is this what you are looking for:

I assume that your panel identifier is called id 
and the time variable t:

// number of periods per person
bys id : gen Nt = _N

// number of person
bys id (t) : gen first = _n == 1
count if first

Hope this helps,
Maarten

-----------------------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index