Statalist The Stata Listserver


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

st: RE: Manipulating variables with repeated observations


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Manipulating variables with repeated observations
Date   Tue, 17 Oct 2006 19:16:07 +0100

You should find out about -by:-. 

For example: 

bysort MRN (VisitDate) : gen visit = _n 
by MRN : gen change = BMI[_N] - BMI[1] 

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

Karen R. Flórez
 
> I have a dataset with kids BMIs that looks like this:
> 
> MRN     VisitDate   BMI
> 
> 123     10/20/04    30
> 
> 123      6/11/05    25
> 
> 123      4/14/06    25
> 
> 222
> 
> 222
> 
> 222
> 
> 
> 
> Where MRN is the unique identifier. Kids had different visits at
> different times and BMI were take at each time. How can I generate
> a variable that codes for Visit 1,2,3,etc? So that I can measure
> the change between baseline and last follow-up?

*
*   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