You're right, I think.
gen whichislongest = ""
gen longest = .
foreach v in sixmo1 oneyr1 twoyr1 threeyr1 {
replace whichislongest = "`v'" if `v' < .
replace longest = `v' if `v' < .
}
Nick
[email protected]
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Dev Vencappa
> Sent: 09 December 2004 13:42
> To: [email protected]
> Subject: st: RE: creating a list sh-owing only highest values
>
>
> >>
>
> Nick, would max() do the job here? It seems that he wants the
> listing of only the highest of these four recording periods.
> I think max() will only retrieve the largest number from
> these, but not the highest period?
>
> Dev
>
> >>> [email protected] 12/09/04 1:34 pm >>>
> -max()- function ?
>
> Nick
> [email protected]
>
> > -----Original Message-----
> > From: [email protected]
> > [mailto:[email protected]]On Behalf Of Michael
> > McCulloch
> > Sent: 08 December 2004 22:54
> > 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 . |
>
*
* 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/