Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: list duplicates but within subgroups

From   Nick Sanders <>
Subject   Re: st: list duplicates but within subgroups
Date   Fri, 31 Dec 2010 00:21:02 -0800

Hi Michael,

Perhaps I'm not understanding, but I believe the command is even easier than those you've suggested. Try:

"duplicates list school id"

That should list any duplicates of school AND id, which I think is what you want. If you have a bunch of data, I might suggest 

"duplicates tag school id, gen(dupes)"

rather than list. Then "browse if dupes ~= 0" and you'll see all your duplicates.


Nicholas J. Sanders, Ph.D.
Postdoctoral Fellow
Stanford Institute for Economic Policy Research
366 Galvez St, Room 228
Stanford, CA 94305

On Dec 30, 2010, at 11:56 PM, Michael Costello wrote:

> Folks,
> I have a poorly coded dataset that was typed from several thousand
> paper surveys.  Often a stack of surveys would be entered into the
> computer and then later entered again because of poor record keeping.
> Each survey has two variables of interest, school_code and id.
> Neither is unique, but there should be only one of each id in each
> school_code.  For example, I should not have two children at
> school_code=10 who both have the same id number, yet there will be
> students at every school who have id=1, 2, etc.
> I'm trying to find a command that uses some kind of subgroup option
> for a -duplicates list- command.  I've tried all the easy ones
> ("duplicates list id, by school", "duplicates list id, over school",
> "duplicates list id, sepby(school_code)" ) all with no luck.  Does
> anyone have any ideas of commands, macros, or websites that might help
> me with this?  Thanks for your help.
> --
> Michael Costello
> RTI International
> *
> *   For searches and help try:
> *
> *
> *

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index