Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: RE: Identify 1st observation in each group in a panel data model


From   "Scott Merryman" <smerryman@kc.rr.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: RE: Identify 1st observation in each group in a panel data model
Date   Thu, 14 Apr 2005 18:40:20 -0500

Thanks Nick; I often forget this construction.

Scott


> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
> Sent: Monday, April 11, 2005 4:25 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: RE: RE: Identify 1st observation in each group in a panel
> data model
> 
> This code can be condensed to
> 
> bysort code (year): gen DV = _n == 1
> 
> Nick
> n.j.cox@durham.ac.uk
> 
> Scott Merryman
> 
> > How about this:
> >
> > gen DV = 0
> > bysort code (year): replace DV = 1 if _n == 1
> >
> 


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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