Statalist


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

Re: ***SPAM*** st: compare variables


From   Richard J Stoll <[email protected]>
To   [email protected]
Subject   Re: ***SPAM*** st: compare variables
Date   Thu, 30 Aug 2007 01:11:15 -0500 (CDT)

egen var3 = rowmax(var1 var2)

On Thu, 30 Aug 2007, Stat List wrote:

> Hi Statalist,
>
> If I have two variables with numeric contents, is there any Stata command to
> compare them, and get the maximum into another variables?
>
> Example, comparing (elements by elements) var1 and var2, and then creating
> var3=max(var1, var2)
>
> Var1 var2 var3
> 12	32	32
> 21	12	21
> 3	32	32
> 32	12	32
> ..	..	..
>
------------------------------------------------------------------------
Richard J. Stoll * Professor of Political Science * Rice University
Dept. Political Science MS 24 * P.O. Box 1892 * Houston TX 77251-1892
E-mail: [email protected] * Tel: 713-348-3362 * FAX: 713-348-5273

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