Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: or operator with lists of variables


From   "Loew, Philipp" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: or operator with lists of variables
Date   Mon, 13 Jan 2014 21:50:18 +0000

Dear Statalists,

I try to solve the following problem:
- I know what to to in a simple case, e.g.:

gen identical=.
replace identical=1 if base1==variable1 | base1==variable2 | base1==variable3

- however, I would like to compare two lists of variables (base1-base20 and var1-var25) with the "or operator" (I try to 
describe it in "pseudo-code"):

gen identical=.
replace identical=1 if (base1-base20) == (var1-var25) 

- In this case the condition should be satisfied if any of the base and var combinations has identical values.  

Thank you!

Kind regards
Philipp 

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index