At 03:36 PM 6/22/02 -0500, you wrote:
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
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.
Joel
----------------------------------------------------------------------------
------------------------
Fred Wolfe Tel
(316) 263-2125
National Data Bank for Rheumatic Diseases Fax (316) 263-0761
Wichita,
Kansas [email protected]
----------------------------------------------------------------------------
-------------------------
*
* 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/
*************************************************
Joel E. Pike
School of Business
University of Wisconsin
1238 Grainger Hall
975 University Avenue
Madison, WI 53706-1323
Tel: 608-265-4830
*************************************************
*
* 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/