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

RE: st: Winning and losing


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Winning and losing
Date   Fri, 21 Nov 2003 12:01:37 -0000

I've commented in another posting with a different 
solution. Note that this one can be streamlined 
a little. 

egen max = rmax(conpc, labpc, ldmpc, natpc, othpc)
foreach x in con lab ldm nat oth {
	gen `x'win = max == `x'pc 
}
drop max

Nick 
[email protected] 

Matt Dobra
 
> Not that elegant, and might be problematic should the data 
> show a tie, but:
> 
> egen max=rmax(conpc, labpc, ldmpc, natpc, othpc)
> foreach x in con lab ldm nat oth {
> egen `x'win=diff(`x'pc max)
> recode `x'win (1=0) (0=1)
> }
> drop max

*
*   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