Statalist


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

st: RE: RE: combining values distributed over multiple observations


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: combining values distributed over multiple observations
Date   Tue, 8 Dec 2009 23:51:17 +0100

<>

" It seems to be at the intersection of ideas behind reshape / stack"



-reshape- does indeed look like a great solution here, but really your
dataset is neither exactly "long" nor "wide"...

-stack- seems a little far fetched. I rarely try to use it for this kind of
data management problem...

HTH
Martin


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Martin Weiss
Sent: Dienstag, 8. Dezember 2009 23:39
To: [email protected]
Subject: st: RE: combining values distributed over multiple observations


<>

Could be as easy as


*******
clear*

inp var:mylabel T1      T2      T3      T4     T5 , auto
A   .129       .         .          .         .
A      .          .647   .          .         .
A      .           .        .991    .         .
A      .           .         .        .582    .
A      .           .         .         .       .043
end

compress

collapse (min) T?, by(var)
list, noo
*******


HTH
Martin


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

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

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