Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Data manipulation with long datasets


From   clinton.thompson@summitllc.us
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Data manipulation with long datasets
Date   Mon, 15 May 2006 16:38:14 -0700 (PDT)

sara,
you may want to search for the command -snapspan- since what you describe
you need may be addressed w/ what -snapspan- accomplishes.  type -findit
snapspan- or -help snapspan-...
--clint



> Hi,
>
> I am trying to follow the faqs "How do I analyze multiple failure-time
> data using Stata" (Cleves, 1999) to analyze some data concerning
> consultation with a family doctor. I think that I need to follow the
> Andersen and Gill model in section 3.2.1 for what I would like to do.
> The means that the data need to be in the form:
>
>       | id     group   time0   time   status   number   size |
>       |------------------------------------------------------|
>       |  1   placebo       0      1        0        1      3 |
>       |  2   placebo       0      4        0        2      0 |
>       |  3   placebo       0      7        0        1      0 |
>       |  4   placebo       0     10        0        5      0 |
>       |  5   placebo       0      6        1        4      0 |
>       |------------------------------------------------------|
>       |  5   placebo       6     10        0        4      0 |
>       |  6   placebo       0     14        0        1      0 |
>       |  7   placebo       0     18        0        1      0 |
>       |  8   placebo       0      5        1        1      3 |
>       |  8   placebo       5     18        0        1      3 |
>       |------------------------------------------------------|
>       |  9   placebo       0     12        1        1      1 |
>       |  9   placebo      12     16        1        1      1 |
>       |  9   placebo      16     18        0        1      1 |
>       +------------------------------------------------------+
> My data are currently in long form with multiple consultations per
> person and a date for each of these consultations (which I have
> converted to an edate to allow calculations). I can easily make the date
> of the consultation representative of the 'time' variable in the example
> (by subtracting the start time of the study from the consultation date)
> but I cannot work out how to create an equivalent to the 'time0'
> variable where I need the time variable from the preceding row to become
> time0. I thought I might need some sort of within person command but I
> am struggling to find anything like this.
>
> My data look like this, where duplicate_pp is the number of the
> consultation in the particular individual:
>
> id    cons_dt      duplicate_pp
> 26    05 Jun 00    1
> 26    18 Aug 00    2
> 26    13 Oct 00    3
> 26    10 Nov 00    4
> 26    25 May 01    5
> 26    13 Jun 01    6
> 26    16 Jun 01    7
> 26    28 Jun 01    8
> 26    23 Oct 01    9
> 26    20 Nov 01    10
> 74    21 Dec 01    1
> 74    15 Jan 02    2
> 74    29 Jan 02    3
> 86    30 Mar 00    1
> 86    27 Apr 00    2
> 86    05 May 00    3
> 86    14 Jun 00    4
> 86    05 Feb 02    5
>
> Could anyone help me out with creating the time0 variable please?
> Thanks
> Sara
>
> --
> Sara Mottram
> Research Assistant: Biostatistics
> Primary Care Musculoskeletal Research Centre
> Primary Care Sciences
> Keele University
> Staffordshire, ST5 5BG
> Tel:  01782 584711
> Fax:  01782 583911
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index