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: On event pr 60 days


From   anne broe <annebroe@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: On event pr 60 days
Date   Tue, 5 Mar 2013 13:38:33 +0000

I am looking to limit numerous records for the same event to one
record per 60 days. If a new event is recorded after 61 days or more
it need to be a new event (and any following events within 60 days of
this event to be recorded as the second event) etc.

I dont know how else to describe it


On 5 March 2013 13:26, Nick Cox <njcoxstata@gmail.com> wrote:
> Identifying events within 60 days of the first event is just
>
> bysort id (date) :  ??? if date - date[1] <= 60
>
> but I don't know what ??? would be in your case as I don't know what
> you mean by adding to the first event.
>
> See also -panelthin- from SSC.
>
> Nick
>
> On Tue, Mar 5, 2013 at 1:12 PM, anne broe <annebroe@gmail.com> wrote:
>
>> I need to be able to identify several events within 60 days of the first
>> record to be recorded as one event.
>>
>>  My data look like this
>> id   date             event
>> 1   01.01.2005     xxx
>> 1   02.01.2005     xxy
>> 1   02.05.2005     xxx
>>
>> I would like to identify the first event and add any event within 60 days
>> to the first event. Any event after 60 days should have its own record, and
>> any event within 60 days after this event be recorded as the second event
>> etc.
>>
> *
> *   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