Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: RE: Question erase duplicates values


From   Liss Palamkunnel <[email protected]>
To   [email protected]
Subject   Re: st: RE: RE: Question erase duplicates values
Date   Tue, 12 Aug 2008 11:10:16 -0700 (PDT)

tag will probably also work.

egen tag=tag(id)
replace id="" if tag==0
drop tag



--- On Tue, 8/12/08, Sergiy Radyakin <[email protected]> wrote:

> From: Sergiy Radyakin <[email protected]>
> Subject: Re: st: RE: RE: Question erase duplicates values
> To: [email protected]
> Date: Tuesday, August 12, 2008, 1:05 PM
> Sorry, I didn't get it the first time.
> 
> May be this will work:
> 
> bysort id: replace id=. if _n!=1
> 
> 
> Regards, Sergiy
> 
> 
> On 8/12/08, Daniel Sepulveda-Adams <[email protected]>
> wrote:
> > Nick
> >
> > Sorry that I was not very precise & I understand
> your explanation, let see
> > if I can be more precise. EX:
> >
> > ID      ndc     units1  units2  units3
> > ----------------------------------------
> > 1       1       5       6       7
> > 1       1       4       8       9
> > 2       2       7       8       6
> > 2       2       8       2       1
> > 3       3       1       4       6
> > 3       3       4       6       8
> >
> > What I need is
> > ID      ndc     units1  units2  units3
> > ----------------------------------------
> > 1       1       5       6       7
> > .       1       4       8       9
> > 2       2       7       8       6
> > .       2       8       2       1
> > 3       3       1       4       6
> > .       3       4       6       8
> >
> > The command that I used was
> > Duplicates drop ID, but that drop all the observations
> that were duplicates
> > not just the duplicates values in the variables ID
> >
> > Let me know if that helps to understand my problem.
> >
> > Best regards ---
> >
> > Daniel A. Sepulveda Adams
> > Research Scientist - PRIME Institute
> > College of Pharmacy - University of Minnesota
> > 308 Harvard ST SE, Weaver Densford Hall, 7-159
> > Minneapolis, MN, 55455, USA
> > Phone: 612-624-8489
> > Cell Phone: 651-295-7771
> > Fax: 612-625-9931
> > Email: [email protected]
> >
> > -----Original Message-----
> > From: [email protected]
> > [mailto:[email protected]] On
> Behalf Of Nick Cox
> > Sent: Tuesday, August 12, 2008 12:11 PM
> > To: [email protected]
> > Subject: st: RE: Question erase duplicates values
> >
> > There is no code here and no example data to be clear
> on what you tried.
> >
> >
> > So, how can anyone answer this except by guessing?
> >
> > The fact that values of an identifier are repeated
> does not mean that
> > the dataset should be cleaned up by removing
> duplicates of the
> > identifier. That principle would wreak havoc on panel
> data. Cloning the
> > identifier makes no difference to that principle. What
> is true of the
> > original is true of the clone, necessarily.
> >
> > Perhaps you did something like
> >
> > . duplicates drop clonedid
> >
> > And -duplicates- refused. I am very pleased to hear
> that. I designed
> > that behaviour into -duplicates- to protect people
> from losing
> > information.
> >
> > Perhaps you did something else altogether, in which
> case please say
> > precisely what.
> >
> > Nick
> > [email protected]
> >
> > Daniel Sepulveda-Adams
> >
> > I'm trying to created a unique ID to make a merge
> between two date set
> > But the Unique ID is a variable that have many
> duplicates values,
> > therefore
> > what I did was clone the variables and try to erase
> the duplicates
> > values
> > but just in the NEW variable but I was not able to do
> that. Anyone has
> > an
> > idea how to do that? Thank you for your time.
> >
> >
> > *
> > *   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/
> >
> *
> *   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index