Bookmark and Share

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


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

st: eliminate duplicate


From   Rongrong Zhang <[email protected]>
To   [email protected]
Subject   st: eliminate duplicate
Date   Sat, 28 Dec 2013 14:52:10 -0500

Hello,

this is a very rudimentary quesiton:

I want to keep the unique combination of the following two variables
(string type)

naics    io_nr
.            5417
.            5417
5417       5417
5417       5417
.             1110
.              1110
111          1110


sort io_nr naics
duplicates tag io_nr naics, gen(dup)

I do not think I should do : drop if dup>0,  because that will drop
both rows of 5417.
would it be better to do :   bysort naics: gen x=_n;  drop if x>1

thanks!

Rochellle



my data set
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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