Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: creating a list showing only highest values


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   st: RE: creating a list showing only highest values
Date   Wed, 8 Dec 2004 19:13:16 -0600

> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Michael McCulloch
> Sent: Wednesday, December 08, 2004 4:54 PM
> To: [email protected]
> Subject: st: creating a list showing only highest values
> 
> Hello Statalist members,
> I have a set of trials, which have one, two, or three year follow-up.
> I would like to create a list from these trials showing only the number
> surviving at the longest point of follow-up.
> For example, in the list below I would to show only the one year data for
> trial id==43, and two year data for id==14.
> I have explored the help for if, bysort, and exp, without any luck.
> Can this be done without programming (as I have not learned this yet)?
> 
> . list id  sixmo1 oneyr1 twoyr1 threeyr1 if exc==0
> 
>       +-------------------------------------------+
>       |  id   sixmo1   oneyr1   twoyr1   threeyr1 |
>       |-------------------------------------------|
>    1. |  43       12        7        .          . |
>    2. | 191       13        2        .          . |
>    3. |  22       15        5        .          . |
>    5. |  14       16       14        3          . |
> 
> 
> 

gen year_max = oneyr1
replace year_max = twoyr1 if twoyr !=.
replace year_max = threeyr1 if threeyr !=.
l id year_max

Scott



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