Statalist


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

Re: st: Clustered Data Format


From   Austin Nichols <[email protected]>
To   [email protected]
Subject   Re: st: Clustered Data Format
Date   Tue, 17 Mar 2009 20:47:38 -0400

john metcalfe <[email protected]> :
See -help reshape- or try out:

ren y_first y1
ren y_second y2
reshape long y, i(patientid days_betw) j(obs)
replace days_betw=0 if obs==1

On Tue, Mar 17, 2009 at 8:37 PM, john metcalfe <[email protected]> wrote:
> Dear Statalist,
> Forgive me if this is too elementary of a question, but I have a
> longitudinal data set in Format A below upon which I would like to
> perform linear mixed effects regression (y on days_b grouped by
> patientid). Is there an easy way to convert the data to Format B?
> Many thanks,
> John
>
> Format A: (current)
> patientid       y_first y_second        days_betw
> 299729  0                      0        64
> 295861  0.17                 0.08       63
> 292641  0.15                  0.5       69
>
> Format B: (desired)
> patientid       y       days_betw
> 299729  0       0
> 299729  0       64
> 295861  0.17    0
> 295861  0.08    63
> 292641  0.15    0
> 292641  0.5     69

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index