Statalist


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

st: finding max of several variables


From   "Data Analytics Corp." <dataanalytics@earthlink.net>
To   Stata Listserve <statalist@hsphsun2.harvard.edu>
Subject   st: finding max of several variables
Date   Mon, 06 Jul 2009 12:32:29 -0400

Hi,

I'm still new to Stata programming, so I hope someone can help with a simple problem. I have five variables that are probabilities estimated from mlogit: prob3, prob4, prob7, prob11, prob12, each with 734 cases. I want to find the max for each case using something like

max(prob3, prob4, prob7, prob11, prob12)

but then get the position in this list for that max for each case. In short, for case 1, if the max is prob4, I want to get 2; if it's prob11, I want 4; etc. I should have 734 positions of the max in the list. How can this be done? Any help is appreciated.

Thanks,

Walt



--
________________________

Walter R. Paczkowski, Ph.D.
Data Analytics Corp.
44 Hamilton Lane
Plainsboro, NJ 08536
________________________
(V) 609-936-8999
(F) 609-936-3733
dataanalytics@earthlink.net
www.dataanalyticscorp.com

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