Statalist The Stata Listserver


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

Re:st: RE: converting variable labels to proper case with apostrophes


From   Joseph Coveney <[email protected]>
To   Statalist <[email protected]>
Subject   Re:st: RE: converting variable labels to proper case with apostrophes
Date   Sat, 22 Jul 2006 16:39:57 +0900

Nick Cox wrote (excerpted):

proper("foobar's son")

yields

Foobar'S Son

which isn't my view of proper English.

--------------------------------------------------------------------------------

There doesn't seem to be any direct approach using -proper()- other than
substituting with a lower-case ASCII letter character that doesn't otherwise
appear in any variable's label, if Dimitriy is so lucky.

forvalues i = 0/255 {
   display char(`i'), subinstr(proper(subinstr("foobar's son", "'", ///
     char(`i'), 1)), char(`i'), "'", 1)
}

I can understand the function's logic for hyphens (mountbatten-windsor), but
not for ligatures or characters with diacritical marks.  Or apostrophes, for
that matter.  That might be something for StataCorp to ponder.  In the
interim, Dimitriy's problem might yield to an approach using regular
expressions.

Joseph Coveney

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