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]

st: RE: Identifying unique values within duplicate IDs


From   "Cohen, Elan" <cohened@upmc.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Identifying unique values within duplicate IDs
Date   Wed, 27 Mar 2013 20:47:08 +0000

Rebecca,

bys id (PHCQ9): g flag = PHCQ9[1]!=PHCQ9[_N]
egen tag = tag(id)
l id if flag & tag

HTH, 

- Elan


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Rebecca M Sacks
Sent: Wednesday, March 27, 2013 16:33
To: statalist@hsphsun2.harvard.edu
Subject: st: Identifying unique values within duplicate IDs

Hi all!
I'm dealing with a large dataset that had some errors occur when data 
were being recorded. Although each ID should only have one record, most 
of them have two. Anyway, I'm trying to get a list of IDs where the ID 
variable is a duplicate but the values for a second variable (PHQ9 
score) are different within the duplicate ID. Any advice would be 
greatly appreciated.

Thanks,
Rebecca Sacks
*
*   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/


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index