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: repeated measures


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: repeated measures
Date   Tue, 7 Sep 2010 21:12:23 +0100

I think Michael M. is misreading this. It's a long to long mapping, so -reshape- does not spring to mind here. See my earlier suggestions. 

Nick 
n.j.cox@durham.ac.uk 

Michael McCulloch

This is possible with the -reshape- command. What you are starting  
with is the "long" data format, and you can use that command to change  
to "wide." However, there appear to be a few problems with your  
description:
1. Did you mean patient ID=4, not =3, in the last line of the data  
format you're seeking?
2. In the desired data format you list the "glu" data point for  
subject ID=3 as being from a different date than the original 6/1/09.

On Sep 7, 2010, at 12:54 PM, Michael Eisenberg wrote:

> I have a problem I hope you can help with that involves cleaning a
> dataset for analysis.
>
> I have a dataset with about 10K men.  Several men had multiple clinic
> visits, so that there are about 12K observations.  There is also some
> lab data that I'll need that was not obtained until follow up visits.
>
> I would like to only analyze data from the earliest visit and the
> first available lab data.
>
> Can stata do this?
>
>
> Turn this
>
> patient     visitdate    sbp       dm          glu
> 1              1/1/09       140       .             .
> 1              1/4/09       128       .            202
> 1              2/1/09       131      1            .
>
> 2              4/1/09       160      .             341
> 2              4/4/09       144       .            180
> 2              5/1/09       170      1            .
>
> 3              6/1/09       119       .             .
> 3              6/4/09       107       .            .
> 3              7/1/09       124      .            96
>
> 4              9/1/09       104       1          110
> 4              9/4/09       155       .            .
> 4             10/1/09       .         .              .
>
> Into this
>
> patient     visitdate    sbp       dm          glu
> 1              1/1/09       140      1             202
> 2              4/1/09       160      1            341
> 3              6/1/09       119       .            96
> 3              9/1/09       104      1            110
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index