Statalist


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

st: combining values distributed over multiple observations


From   Clyde Schechter <[email protected]>
To   [email protected]
Subject   st: combining values distributed over multiple observations
Date   Wed, 9 Dec 2009 09:47:43 -0800

In the excerpt of data you present, each T variable contains only a single
entry for A, the others being all missing.  If that is true overall (and
you should verify this with appropriate assert statements before
proceding) you can get what you are looking for with:

-collapse (sum) T*, by(var)-

Good luck.

Clyde Schechter
Albert Einstein College of Medicine
Bronx, New York, USA

> - -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Mark Pachucki
> Sent: Dienstag, 8. Dezember 2009 23:35
> To: [email protected]
> Subject: st: combining values distributed over multiple observations
>
> Hello - this seems like an exceedingly simple question, but couldn't find
> a
> reference to relevant syntax in the help. What I'm essentially trying to
> do
> is go from the below format, where a given variable "A" takes different
> values at discrete observations arrayed over T1-T5:
>
> var   T1      T2      T3      T4     T5
>
> A   .129       .         .          .         .
> A      .          .647   .          .         .
> A      .           .        .991    .         .
> A      .           .         .        .582    .
> A      .           .         .         .       .043
>
>
> to the following format, wherein all values of A at each time are
> compressed
> into one observation :
>
> var      T1        T2      T3      T4     T5
>
> A       .129     .647  .991   .582  .043
>
> It seems to be at the intersection of ideas behind reshape / stack (and
> even
> stjoin - except it's not survival-time data). Yet doesn't fall neatly
> within
> any (or does it?)
>
> Thanks in advance,
> Mark



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