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

RE: st: multiple )))brackets, is there a more efficient way?


From   David Kantor <[email protected]>
To   [email protected]
Subject   RE: st: multiple )))brackets, is there a more efficient way?
Date   Tue, 25 May 2004 08:58:55 -0400

At 11:28 AM 5/25/2004 +0100, Nick Cox wrote:
I think Ulrich went to the heart of the matter:
this really pivots on taste. However, that is
linked partly to readability. Moreover, it
is also important to have code that you
can understand, can check, can debug, and can come
back to and revise. If you are in a group, it
is naturally also important that others can
understand your code.
[...]

David Kantor is very fond of -cond()- and
may offer counter-arguments.

Nick
[email protected]
No counter-argument, but one can combine both methods:

#delimit ;
gen byte origin =
cond(nation == 3, 7,
cond(inlist(nation,8,12,69,139,141) ,  10,
cond(inlist(nation,14,82), 8,
cond(nation == 28, -9,
...
)))...) ;


-- David

David Kantor
Institute for Policy Studies
Johns Hopkins University
[email protected]
410-516-5404

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