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 on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: Need Help regarding sorting


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Need Help regarding sorting
Date   Mon, 4 Mar 2013 19:51:20 +0000

bysort patientname (date) : gen second = type == "DS" & type[_n-1] == "DS"

Nick

On Mon, Mar 4, 2013 at 7:43 PM, Michael Stewart
<michaelstewartresearch@gmail.com> wrote:

> I am working on a  health care  database and  am trying to weed out duplicates
>
> My data  is as follows
>
> Patientname   date_of_event type
> xxxx   1/1/2010   HP
> xxxx   1/2//2010 DS
> xxxx   1/3/2010 DS
> xxxx  1/5/2010  HP
> xxxx  1/6//2010  DS
> yyyy   1/4/2011  HP
> yyyy  1/5/2011 DS
>
> Here in this dataset DS refers to discharge summary and HP refers to
> history and physical
>
> I am specifically trying to find out for each patient: if  two DS are
> separated by a HP
*
*   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