A sidenote on this code snippet: It's easy to
miss that -cond()- can produce string results.
I suspect that many users familiar with
similar constructs in other languages which
can produce only numeric results subconsciously
don't think of -cond()- for producing strings.
In Stata, -cond()- was originally only for numeric
results; it was generalised later to allow string results.
In this case
local ne = cond("$S_OS" == "MacOSX", char(150)+char(142), char(241)+char(233))
The improvement in efficiency here is very small, and
the improvement in clarity arguable. In other contexts,
however, one can trim several paragraphs of code to a few lines.
While I'm at it, you can now use c(os) for $S_OS.
local ne = cond(c(os) == "MacOSX", char(150)+char(142), char(241)+char(233))
Kit Baum
> local ne = char(241)+char(233)
> if "$S_OS" == "MacOSX" {
> local ne = char(150)+char(142)
> }
Nick
[email protected]
*
* 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/