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

Re: st: Speaking Stata: by varlist


From   Fred Wolfe <fwolfe@arthritis-research.org>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Speaking Stata: by varlist
Date   Sat, 22 Jun 2002 15:36:39 -0500

At 11:49 AM 6/22/2002 -0400, you wrote:
Dear Statalisters,

In Stata, the

bysort varlist: list varlist if _N>1

is supposed to find duplicates with respect to the bysort varlist.

I have a data set, and I know by the ID variable there is no duplicates, because if I use

bys ID: gen count=_N
tab count

I get count all equal to 1.

However, if I use

bys ID: list varlist if N>1

Stata starts to list every observation from the top.

Why is this happening?
One explanation is that your code:
bys ID: list varlist if N>1

should be

bys ID: list varlist if _N>1

Fred




---------------------------------------------------------------------------- ------------------------
Fred Wolfe Tel (316) 263-2125
National Data Bank for Rheumatic Diseases Fax (316) 263-0761
Wichita, Kansas fwolfe@arthritis-research.org
---------------------------------------------------------------------------- -------------------------
*
* 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