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" <[email protected]>
To   <[email protected]>
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: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Nick Cox
> Sent: Monday, April 11, 2005 4:25 PM
> To: [email protected]
> 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
> [email protected]
> 
> 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index