Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Michael McCulloch <mm@pinestreetfoundation.org> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: repeated measures |
Date | Tue, 7 Sep 2010 13:21:19 -0700 |
Thanks Nick, you're correct I did misread that part.Nevertheless, I suspect that some of the complexity you allude to your your prior reply to Michael E. is that he wishes to selectively carry forward certain field values. For example, something like: replace the missing value from (first visit at which it's available ) if that value is present in that patient's first visit I would know how to define the first visit a patient had, but not how to find the first visit at which a lab value appeared.
Michael On Sep 7, 2010, at 1:12 PM, Nick Cox wrote:
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/
Best wishes, Michael McCulloch, LAc MPH PhD Pine Street Foundation 124 Pine Street San Anselmo, CA 94960-2674 tel: 415-407-1357 fax: 206-338-2391 * * 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/