Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: FW: argmax for -summaraize-


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: FW: argmax for -summaraize-
Date   Mon, 24 Jul 2006 22:04:24 +0100 (BST)

something like:

sysuse auto, clear
tab rep78
gen cond = rep78==3
bys cond (price): gen max = _n==_N & cond==1
sum price if cond
sum price if max==1

HTH,
Maarten

--- "Feiveson, Alan H. (JSC-SK311)" <[email protected]> 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' {


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


		
___________________________________________________________ 
Now you can scan emails quickly with a reading pane. Get the new Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html
*
*   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