To avoid the rounding problem you can try
gen cond= [if and/or in statments]
bysort cond: egen xmax=max(x)
where "mycond" should probably include x>=.
hth,
Jeph
Feiveson, Alan H. (JSC-SK311) wrote:
Hello - Does anyone know an efficient way to identify the observation at
which a particular variable is minimum or maximum (subject to `if'
and/or `in') ?
Apparently -summarize- does not return this value. I see nothing in
-egen- nor does "findit argmax" produce anything. I can program this
myself by looping through the observations but that is not efficient. In
particular one cannot gurantee that anything like
summ x
local xmax=r(max)
if x = `xmax' {
...
will work because of rounding. I also wish to avoid -preserve-,
-collapse-, etc
Al Feiveson
*
* 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/
*
* 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/