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

st: data loop question


From   "Bauldry, Shawn" <Sbauldry@ppv.org>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: data loop question
Date   Wed, 11 May 2005 14:44:00 -0400

Statalist,

I have a series of variables, say x1-x10, and I would like to determine
the numeric suffix associated with the variable that has the maximum
value for each case.  For example, maybe x9 has the max for case 1 and
x7 has the max for case 2, then I would like to end up with a variable,
say MaxX, that has a 9 and 7 for the first two cases respectively.  I
think a data loop is the way to go, but I've tried working out a loop to
do this and it's not coming to me.


Thanks,
Shawn

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