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

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


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Identify 1st observation in each group in a panel data model
Date   Mon, 11 Apr 2005 22:24:52 +0100

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