Thanks for this, but I don't understand it at all.
Why you want to throw away information about your ID? If you map second
and higher occurrences of each ID to missing, you just creates
duplicates of missing, and it is difficult to see how a -merge- could
then work properly.
Ironically enough, the syntax
duplicates drop ID
that I alluded to is illegal. Perhaps what you tried was -duplicates
drop ID, force- and that would have the effect you describe.
Nick
[email protected]
Daniel Sepulveda-Adams
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.
Nick Cox
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/