Statalist


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

Re: st: Reshape-Like Question


From   Alan Neustadtl <alan.neustadtl@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Reshape-Like Question
Date   Wed, 4 Mar 2009 09:10:47 -0500

Yes...my thanks to Scott and Nick by pointing out the crucial fact of
creating a unique identifier.  I tried that, but incorrectly specified
the reshape, then dropped the id and incorrectly specified the
reshape.  I had all the pieces to the puzzle but couldn't put them
together until I was pointed in the correct direction.

As for Nick's other comments, he is probably right that it may be
possible to work column wise on the data and my limits might be in
seeing the big picture.

What I am trying to do is create a symmetrical measure of blood
glucose variability called the "average daily risk range" (ADRR).  The
measure requires that each participant has a minimum of three blood
glucose readings for at least 14 nonconsecutive days of readings in a
30 day period.

Using rowwise egen commands gave me some leverage on identifying the
relevant patients.  I tried using -by- and -collapse- to come to the
same place (one risk range measure per patient/day) but eventually
became lost in the details and worked this into a -reshape- problem.
I am open to learning new things so please if you have time I would
appreciate other attacks on my problem.

Best,
Alan


On Wed, Mar 4, 2009 at 8:51 AM, Nick Cox <n.j.cox@durham.ac.uk> wrote:
> Scott's example code underlines that this is indeed a -reshape- problem and that you just need the one trick of creating an identifier that will be used for the columns.
>
> Other trickery in this territory is detailed at
>
> FAQ     . . . . . . . . . . . . . . . . . . . . . . . .  Problems with reshape
>        12/03   I am having problems with the reshape command. Can
>                you give further guidance?
>                http://www.stata.com/support/faqs/data/reshape3.html
>
>
> But a bigger question is why you want to do this. On the whole you are better off with your existing data structure. Although working rowwise is possible and often natural, as will be explored in some detail in Stata Journal 9(1) 2009, it is difficult to think of anything easier with your new data structure.
>
> Nick
> n.j.cox@durham.ac.uk
>

*
*   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   |   What's new   |   Site index