Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: list duplicates but within subgroups


From   Nick Sanders <sandersn@stanford.edu>
To   statalist@hsphsun2.harvard.edu
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.

Best,
Nick

--
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:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index