That's a dopey example of mine. If you want to map 1 -> 1, 2 -> 2, 3 ->
3, everything else -> 4, you can
do it more concisely. The point is just to mention nesting.
Nick Cox
Your last question is about intention -- what was in the mind of the
program designers -- and
is perhaps best answered by StataCorp. Oddly enough, I've never used the
four argument case that
I can recall. Although some dislike the usage, nesting of -cond(,)- lets
you handle four or more
branches, and I find that more congenial, e.g.
cond(x == 1, 1, cond(x == 2, 2, cond(x == 3, 3, 4)))
Naturally there are many other ways to achieve similar results.
.Nick
[email protected]
Visintainer, Paul
Nick,
Thanks for the coding suggestions. This is exactly what I was looking
for--especially for the multiple variables. And, Nick (Winter), thanks
for the explanation for cond().
One question: was it the intention of the 4-level cond() to code for
missings or is there some other application for it?
*
* 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/