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

RE: st: Speaking Stata: by varlist


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Speaking Stata: by varlist
Date   Mon, 24 Jun 2002 10:15:52 +0100

Joel E. Pike commented on Fred Wolfe:

> >One explanation is that your code:
> >bys ID: list varlist if N>1
> >
> >should be
> >
> >bys ID: list varlist if _N>1
>
> This actually doesn't make any difference.  Either syntax gives you the
> same result, as I confirmed with my own data after I noticed the same
> thing.  I think in the syntax above, _N is not found, so that for every
> observation _N>1.

Not so. _N is automatically (and temporarily) produced w.r.t. the groups
defined
by -id-.  This is a basic feature of -by:-.

If N exists, it is presumably a variable in the original questioner's data
set. (It could also be a scalar.)

*
*   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