Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: First occurence

From   "Austin Nichols" <>
Subject   Re: st: First occurence
Date   Fri, 18 May 2007 10:58:14 -0400

To be sure, and -bys- is a marvelous thing, but I was more thinking of

egen minyr=min(year), by(bdsmaster)
gen fyr=(year==minyr)
tab minyr if fyr, mi
codebook minyr
hist minyr if fyr


On 5/17/07, Nick Cox <> wrote:
Quite so.

As you know, but some may not,
the first year can always be used, without
putting it into a variable, in ways like this

bysort bdsmaster (year) : gen years_since_first = year - year[1]

*   For searches and help try:

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