Statalist The Stata Listserver


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

Re: st: Treat $ as text rather than indicator for global macro?


From   n j cox <[email protected]>
To   [email protected]
Subject   Re: st: Treat $ as text rather than indicator for global macro?
Date   Fri, 01 Jun 2007 16:07:01 +0100

Two solutions:

1. Use -char()- to summon up an ASCII character.
May be OS-dependent. See also -asciiplot- on SSC.

2. (More Stataish.) Use SMCL. "{c S|}" is the
dollar character.

. local y "Balance ({c S|}bn)"

. di "`y'"
Balance ($bn)

Incidentally, I guess you are showing money
amounts in billions of USD. Inserting an apostrophe
into a contraction or abbreviation is, I believe, ungrammatical,
or nonstandard, at least in English. You wouldn't
write "m's" for "metres" or "lb's" for "pounds".

Nick
[email protected]

Ferry, Danielle

This works fine:
. di "Balance (\$Bn's)"
Balance ($Bn's)

But this doesn't:
. local Y "Balance (\$Bn's)"
. di "`Y'"
Balance ('s)

How can I make it display correctly in the second instance?
*
*   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