Statalist The Stata Listserver


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

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


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: converting variable labels to proper case with apostrophes
Date   Fri, 21 Jul 2006 23:24:47 +0100

Please ignore previous. 

What is apparent is that you need compound double quotes, 
but I couldn't get those to work either. 

This is my best offering. 

foreach v of var * { 
	local lbl : var label `v' 
	local lbl = proper("`lbl'")
	label var `v' "`lbl'"  
}

However, my test was

foobar's son

-- but 

proper("foobar's son") 

yields 

Foobar'S Son

which isn't my view of proper English. 

Incidentally, there is a -labutil- package on SSC.
I don't know any package called -labutils-. 
"suite" has no Stata meaning that I know of. 

Nick 
n.j.cox@durham.ac.uk 

Dimitriy V. Masterov
 
> I am trying to convert my variable labels to proper case, so that
> instead of "government office region" I have "Government Office
> Region". I used this code:
> 	foreach var of varlist _all {;
> 		set trace on;
> 		lab var `var' "`=proper("`:var label `var''")'";
> 	};
> 
> but it runs into problem when there are apostrophes in the label. I
> checked out the labutils suite, but I don't think there's a solution
> there.

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index