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]
Re: st: Identifying unique values within duplicate IDs
From
Rebecca Sacks <[email protected]>
To
[email protected]
Subject
Re: st: Identifying unique values within duplicate IDs
Date
Wed, 27 Mar 2013 14:08:36 -0700
Thank you guys! This worked famously.
-R
On Mar 27, 2013, at 2:04 PM, Rebecca Pope wrote:
> I would just add to Jeph's suggestion:
> bys ID (PHQ9) : gen byte tagged=(PHQ[1]!=PHQ[_N])*(_n==1)
>
> This modification will only tag the first observation on an ID that
> meets the condition of interest (PHQ 9 score changes). Then you can
> just -list- the IDs.
>
> -list ID if tagged, noobs clean-
>
> Since you have a large dataset, you might want to -tab- the tagged
> variable first and make sure that the list of duplicates whose scores
> change isn't too long. If it will be, consider just saving it to a
> file rather than just having it in the results window.
>
> Regards,
> Rebecca
>
>
> On Wed, Mar 27, 2013 at 3:45 PM, Jeph Herrin <[email protected]> wrote:
>>
>> try
>>
>> bys ID (PHQ9) : gen byte tagged=PHQ[1]!=PHQ[_N]
>>
>> cheers,
>> Jeph
>>
>>
>>
>> On 3/27/2013 4:33 PM, Rebecca M Sacks wrote:
>>>
>>> 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/
> *
> * 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/