Statalist


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

Re: st: compare variables


From   "Sebastian F. Büchte" <sfbuechte@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: compare variables
Date   Thu, 30 Aug 2007 09:40:35 +0200

Try "search compare" from inside Stata command window.

. search compare

Keyword search

        Keywords:  compare
          Search:  (1) Official help files, FAQs, Examples, SJs, and STBs

Search of official help files, FAQs, Examples, SJs, and STBs

[...]

[D]     compare . . . . . . . . . . . . . . . . . . . .  Compare two variables

[...]

Sebastian


2007/8/30, Stat List <statlist@gmail.com>:
> 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
> ..      ..      ..
>
> I think  I can write the loop for all observations, but I think that Stata
> have this kind of command that I just don't know yet.
>
> Any help? Thanks so much
> Stat
>
> *
> *   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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index