Stata makes this kind of change extremely easy.
bysort id (whatever) : keep if !missing(whatever[_N]) & _N >= 6
-sort-ing within panels means that any missings are sorted to last.
This is covered in any tutorial on -by:-.
Nick
njcoxstata@gmail.com
On 1 May 2013 14:14, Andreas Dall Frøseth <Andreas.Froseth@stud.nhh.no> wrote:
>
> Is it possible to delete a entire panel id/group from the set if a certain condition is true for the first year?
> I'm trying to keep certain spells in my dataset, and by using the -tsspell- (SSC) I have managed to keep panel variables with runs equal or above 7 years. But, I also wish to keep panel groups with 6 year runs IF the value in the variable "category" is nonmissing for the first year (or actually every year).
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/